This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

printf with "%.ls" broken


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]