In article
<3ca40801-9360-4e74-8761-f7c42313012c@e6g2000prf.googlegroups.com>,
> For the life of me I can't see why the following code hangs in
> fprintf():
[quoted text clipped - 11 lines]
> And when it hangs in fprintf(), I can look at fn_buf in the debugger
> and it is a well-formed C-string ...
That is not sufficient for safely making that call. Consider:
fprintf( stderr, "%s%d%6f");
The safe call is:
fprintf( stderr, "%s", fn_buf);
Using a non-constant string as second argument to fprintf (or first
argument to printf) almost never is a good idea. See also
<http://en.wikipedia.org/wiki/Format_string_attack>
Reinder
snnopy67 - 22 Feb 2008 21:54 GMT
> That is not sufficient for safely making that call. Consider:
>
> fprintf( stderr, "%s%d%6f");
Thanks a lot for your response!
Yes, you are right.
The fprintf() call was just meant for debugging.
The strings I printed were just path names and didn't contain any
"funny" characters.
Still, I changed it to
fprintf(stderr, "%s\n", fn_buf );
but to no avail. I still hangs ... :-(
Best regards,
Gabriel.