Bug in _VFPRINTF_R

Eric Blake ebb9@byu.net
Sun Sep 16 02:39:00 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Samuel Vinson on 9/15/2007 6:34 AM:
> I'm sorry Eric, but I gave you a specific example :
>    printf("%.*s\n",len,(char *)NULL) /* len = 0 */
> 
> and not printf("%s", (char *)NULL)

OK, I see what you are complaining about (this was the first time you
explicitly mentioned the case where precision is less than 6).  Indeed, as
long as newlib is providing an extension for a replacement string for
NULL, it should take precision into account.  Jeff, okay to apply this
patch?  [However, I still maintain that your code has a bug for expecting
any sane behavior when passing a NULL argument for %s.]

2007-09-15  Eric Blake  <ebb9@byu.net>

	* libc/stdio/vfprintf.c (_VFPRINTF_R): Take precision into account
	for %s on NULL.  Skip NULL check when optimizing for size.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----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

iD8DBQFG6+u284KuGfSFAYARApoRAJ9xgjM2EC8Ha9qGwwPLOLP9xwg3ngCaAt8H
dyartGnGWzIOZpmy39Kh0UU=
=zDW1
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib.patch24
URL: <http://sourceware.org/pipermail/newlib/attachments/20070916/733ff978/attachment.ksh>


More information about the Newlib mailing list