aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox/patches/991-upstream_logger_fix.patch
blob: f225a1b601b6f1651abcd7729cd0b2357806355e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: busybox-1.7.2/sysklogd/logger.c
===================================================================
--- busybox-1.7.2.orig/sysklogd/logger.c	2007-10-30 15:34:59.000000000 -0500
+++ busybox-1.7.2/sysklogd/logger.c	2007-10-30 15:35:07.000000000 -0500
@@ -107,7 +107,7 @@
 	argv += optind;
 	if (!argc) {
 #define strbuf bb_common_bufsiz1
-		while (fgets(strbuf, BUFSIZ, stdin)) {
+		while (fgets(strbuf, COMMON_BUFSIZE, stdin)) {
 			if (strbuf[0]
 			 && NOT_LONE_CHAR(strbuf, '\n')
 			) {
@@ -117,11 +117,11 @@
 		}
 	} else {
 		char *message = NULL;
-		int len = 1; /* for NUL */
+		int len = 0;
 		int pos = 0;
 		do {
 			len += strlen(*argv) + 1;
-			message = xrealloc(message, len);
+			message = xrealloc(message, len + 1);
 			sprintf(message + pos, " %s", *argv),
 			pos = len;
 		} while (*++argv);