On Wed, Jun 11, 2008 at 10:11:07AM +0300, Dan Bar Dov wrote: > Usually we use printf with a string literal for the format, > e.g. > printf("%d flowers\n",count); > > But if I put the format in a variable (as opposed to a string literal), I > find that > escape processing does not occur. > > so using the program: > > void main(int ac, char **av) > { > printf(av[1],av[2]); > } > > and running (# is the prompt) > # ./test "%s flowers\n" 7 > > give the output > 7 flowers\n# > > [same with # ./test "%s flowers\\n" 7 which yields 7 flowers\\n# ] > > Any idea how to get the variable containing the format to undergo escape > sequence processing?
I have no idea, but I wouldn't be surprized to hear that it's a measure of a recent gcc/ld/glibc against format string attacks (google in case you do not know enough about this). Did you try compiling with -Wall? Did you try different versions of the gcc/ld/glibc toolchain? -- Didi ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]