Loading...
stdio/FreeBSD/puts.c.patch /dev/null Libc-763.12
--- /dev/null
+++ Libc/Libc-763.12/stdio/FreeBSD/puts.c.patch
@@ -0,0 +1,30 @@
+--- puts.c.bsdnew	2009-11-11 13:33:14.000000000 -0800
++++ puts.c	2009-11-11 13:33:14.000000000 -0800
+@@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/p
+ #include "libc_private.h"
+ #include "local.h"
+ 
++// 3340719: __puts_null__ is used if string is NULL.  Shared by fputs.c
++__private_extern__ char const __puts_null__[] = "(null)";
++
+ /*
+  * Write the given string to stdout, appending a newline.
+  */
+@@ -52,12 +55,15 @@ puts(s)
+ 	char const *s;
+ {
+ 	int retval;
+-	size_t c = strlen(s);
++	size_t c;
+ 	struct __suio uio;
+ 	struct __siov iov[2];
+ 
++	// 3340719: __puts_null__ is used if s is NULL
++	if(s == NULL)
++		s = __puts_null__;
+ 	iov[0].iov_base = (void *)s;
+-	iov[0].iov_len = c;
++	iov[0].iov_len = c = strlen(s);
+ 	iov[1].iov_base = "\n";
+ 	iov[1].iov_len = 1;
+ 	uio.uio_resid = c + 1;