Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Andreas Schwab on 10/19/2007 6:58 AM:
> Jim Meyering <address@hidden> writes:
>
>> Could it be a bug in printf for failing, yet not setting the
>> stream-failure indicator that is checked by close_stdout's ferror?
>
> A failure from printf does not necessarily mean an output failure. It
> can also be ENOMEM or EILSEQ, which are unrelated to output.
Wow. You're right. Which means the return value of printf/fprintf must
always be checked in a secure program. It looks like m4 has some bugs in
this area (admittedly corner case, since it is not on user-provided
strings with large padding values, so the likelihood of running out of
memory exactly during the printf is smaller)...
Would it be worth a xprintf and xfprintf gnulib wrapper that exits the
program immediately on non-output errors from the wrapped printf/fprintf?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHGK8c84KuGfSFAYARAvJFAKC0hVnovKl3pf33BBWqle4M1hxw0QCfYmFq
e70Lu8UzXwKYZx7S5LOZMF8=
=0lbq
-----END PGP SIGNATURE-----