svn commit: trunk/uClibc/libc/stdio
carmelo at uclibc.org
carmelo at uclibc.org
Tue Sep 9 12:19:19 UTC 2008
Author: carmelo
Date: 2008-09-09 05:19:19 -0700 (Tue, 09 Sep 2008)
New Revision: 23367
Log:
Fix problem in vfprintf when assertion are enabled.
Here follow the output of my analysis:
__stdio_fwrite expects at least 1 bytes. fputs_unlocked(S,F) calls
fwrite_unlocked and this calls __stdio_fwrite only if bytes to be
written are > 0, otherwise simply returs 0 (that is correct).
During the parsing of format spec it could happen that __stdio_fwrite
is called passing an empty string and with assertion enabled it will abort.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
Modified:
trunk/uClibc/libc/stdio/_vfprintf.c
Changeset:
Modified: trunk/uClibc/libc/stdio/_vfprintf.c
===================================================================
--- trunk/uClibc/libc/stdio/_vfprintf.c 2008-09-09 12:10:17 UTC (rev 23366)
+++ trunk/uClibc/libc/stdio/_vfprintf.c 2008-09-09 12:19:19 UTC (rev 23367)
@@ -1212,8 +1212,7 @@
#define OUTNSTR _outnstr
#define STRLEN strlen
#define _PPFS_init _ppfs_init
-/* Pulls in fseek: #define OUTPUT(F,S) fputs_unlocked(S,F) */
-#define OUTPUT(F,S) __stdio_fwrite((const unsigned char *)(S),strlen(S),(F))
+#define OUTPUT(F,S) fputs_unlocked(S,F)
/* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */
#define _outnstr(stream, string, len) ((len > 0) ? __stdio_fwrite(string, len, stream) : 0)
#define FP_OUT _fp_out_narrow
More information about the uClibc-cvs
mailing list