Re: How to stop problems from printf

2000-09-08 Thread Mike Smith
> In message <[EMAIL PROTECTED]> "John Doh!" writes: > : Issue is must be getting format string from "untrusted" place, but want to > : limit substitution of %... to the substitution of say in example the > : argv[0], but to not do others so that say given "usage: %s filename %p" %p > : not int

Re: How to stop problems from printf

2000-09-08 Thread Mike Smith
> Hello to you am I C coder who to wish write programs we cannot exploit via > code such as below. > > > > > main(int argc, char **argv) > > { > > if(argc > 1) { > > printf(gettext("usage: %s filename\n"),argv[0]); > > exit(0); > >} > >printf("normal execution proceed

Re: How to stop problems from printf

2000-09-08 Thread Garance A Drosihn
At 6:27 PM -0400 9/7/00, John Doh! wrote: >Hello to you am I C coder who to wish write programs we cannot >exploit via code such as below. > >> >> main(int argc, char **argv) >> { >> if(argc > 1) { >> printf(gettext("usage: %s filename\n"),argv[0]); >> exit(0); >> } >> printf("normal

Re: How to stop problems from printf

2000-09-07 Thread Kris Kennaway
On Fri, 8 Sep 2000, Jan Knepper wrote: > I don't know what you are doing with the 'gettext' in the call to 'printf'. Translate the string into a localized version. You can't just printf("%s", gettext(...), args) because the arguments won't be printed, only the raw string returned from gettext wi

Re: How to stop problems from printf

2000-09-07 Thread Warner Losh
In message <[EMAIL PROTECTED]> Kris Kennaway writes: : It also needs to check they are all of the same type, as changing a %d to : a %s for example could conceivably be exploitable. And you would have to : forbid escaped % characters as well. Yeah, I think that would be : doable. We probably shou

Re: How to stop problems from printf

2000-09-07 Thread Jan Knepper
However for just displaying strings I would use puts or fputs. I mean why call a heavy duty function as printf when the job can be very easily done with a puts/fputs. HTH Jan "John Doh!" wrote: > >From: Alfred Perlstein <[EMAIL PROTECTED]> > >To: John Doh! <[EMA

Re: How to stop problems from printf

2000-09-07 Thread Kris Kennaway
On Thu, 7 Sep 2000, Warner Losh wrote: > In message <[EMAIL PROTECTED]> Kris >Kennaway writes: > : gettext() doesnt take any additional arguments, AFAIK it just munges the > : string. The argument substitution was being done by printf() in the > : example given. > > Right. You know how many ar

Re: How to stop problems from printf

2000-09-07 Thread Warner Losh
In message <[EMAIL PROTECTED]> Kris Kennaway writes: : gettext() doesnt take any additional arguments, AFAIK it just munges the : string. The argument substitution was being done by printf() in the : example given. Right. You know how many args are expected, since you know printf. : The only p

Re: How to stop problems from printf

2000-09-07 Thread Kris Kennaway
On Thu, 7 Sep 2000, Warner Losh wrote: > In message <[EMAIL PROTECTED]> "John Doh!" writes: > : Issue is must be getting format string from "untrusted" place, but want to > : limit substitution of %... to the substitution of say in example the > : argv[0], but to not do others so that say given

Re: How to stop problems from printf

2000-09-07 Thread Warner Losh
In message <[EMAIL PROTECTED]> "John Doh!" writes: : Issue is must be getting format string from "untrusted" place, but want to : limit substitution of %... to the substitution of say in example the : argv[0], but to not do others so that say given "usage: %s filename %p" %p : not interpret but

Re: How to stop problems from printf

2000-09-07 Thread John Doh!
>From: Alfred Perlstein <[EMAIL PROTECTED]> >To: John Doh! <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: Re: How to stop problems from printf >Date: Thu, 7 Sep 2000 19:33:14 -0700 > >* John Doh! <[EMAIL PROTECTED]> [000907 19:2

Re: How to stop problems from printf

2000-09-07 Thread Alfred Perlstein
* John Doh! <[EMAIL PROTECTED]> [000907 19:28] wrote: > Hello to you am I C coder who to wish write programs we cannot exploit via > code such as below. > > > > > main(int argc, char **argv) > > { > > if(argc > 1) { > > printf(gettext("usage: %s filename\n"),argv[0]); > > exi

How to stop problems from printf

2000-09-07 Thread John Doh!
Hello to you am I C coder who to wish write programs we cannot exploit via code such as below. > > main(int argc, char **argv) > { > if(argc > 1) { > printf(gettext("usage: %s filename\n"),argv[0]); > exit(0); >} >printf("normal execution proceeds...\n"); > } Issue