I still consider uclibc broken in this respect.
However, the important case is with zero precision. In this case the
pointer value shouldn't matter, and uclibc does break existing software.
I stumbled on this trying out pjsip, a freely available SIP library.

This patch takes care of this specific case only, and with minimal
intrusion.

Signed-off-by: Jones Desougi <[email protected]>
diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c
index 3b00708..a9bed6a 100644
--- a/libc/stdio/_vfprintf.c
+++ b/libc/stdio/_vfprintf.c
@@ -1670,6 +1670,9 @@ static int _do_one_spec(FILE * __restrict stream,
 #endif
 					s = "(null)";
 					slen = 6;
+					/* If precision is zero, the pointer is of no importance. */
+					if (ppfs->info.prec == 0)
+						slen = 0;
 				}
 			} else {			/* char */
 				s = buf;
@@ -1726,6 +1729,9 @@ static int _do_one_spec(FILE * __restrict stream,
 				NULL_STRING:
 					s = "(null)";
 					SLEN = slen = 6;
+					/* If precision is zero, the pointer is of no importance. */
+					if (ppfs->info.prec == 0)
+						SLEN = slen = 0;
 				}
 			} else {			/* char */
 				*wbuf = btowc( (unsigned char)(*((const int *) *argptr)) );
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to