summaryrefslogtreecommitdiff
path: root/libc/debian/patches/libc-sprintf-nul-char.patch
blob: e08e6716b67cf1e4ce4b274cc323b86b914cedb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Description: fixes sprintf(dest, "xxx%cyyy", '\0')
 dest must not be truncated, it must contain "xxx\0yyy\0"
 This bug probably affects only short strings, see asprintf.c
Index: b/usr/src/lib/libc/port/print/asprintf.c
===================================================================
--- a/usr/src/lib/libc/port/print/asprintf.c
+++ b/usr/src/lib/libc/port/print/asprintf.c
@@ -49,7 +49,7 @@ vasprintf(char **str, const char *format
 		len = ret + 1;
 		if ((newstr = malloc(len)) == NULL)
 			return (-1);	/* retain errno from malloc() */
-		(void) strlcpy(newstr, string, len);
+		(void) memcpy(newstr, string, len);
 		*str = newstr;
 		return (ret);
 	}