printf with "%.ls" broken

Andreas Schwab schwab@suse.de
Thu Dec 13 11:14:00 GMT 2001


Printing a wide character string with zero precision should not print
anything.

Andreas.

2001-12-13  Andreas Schwab  <schwab@suse.de>

	* stdio-common/vfprintf.c (process_string_arg): Correctly handle
	zero precision with wide character string format.

--- stdio-common/vfprintf.c.~1.103.~	Fri Aug 24 09:24:04 2001
+++ stdio-common/vfprintf.c	Thu Dec 13 19:59:45 2001
@@ -1195,7 +1195,7 @@
 									      \
 	    memset (&mbstate, '\0', sizeof (mbstate_t));		      \
 									      \
-	    if (prec > 0)						      \
+	    if (prec >= 0)						      \
 	      {								      \
 		/* The string `s2' might not be NUL terminated.  */	      \
 		if (prec < 32768					      \

-- 
Andreas Schwab                                  "And now for something
Andreas.Schwab@suse.de				completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5



More information about the Libc-hacker mailing list