add upstream fixes for 1.7.2
[openwrt.git] / package / busybox / patches / 991-upstream_logger_fix.patch
1 diff -urN busybox-1.7.2/sysklogd/logger.c busybox-1.7.2-logger/sysklogd/logger.c
2 --- busybox-1.7.2/sysklogd/logger.c     2007-09-03 12:48:35.000000000 +0100
3 +++ busybox-1.7.2-logger/sysklogd/logger.c      2007-10-02 10:56:53.000000000 +0100
4 @@ -107,7 +107,7 @@
5         argv += optind;
6         if (!argc) {
7  #define strbuf bb_common_bufsiz1
8 -               while (fgets(strbuf, BUFSIZ, stdin)) {
9 +               while (fgets(strbuf, COMMON_BUFSIZE, stdin)) {
10                         if (strbuf[0]
11                          && NOT_LONE_CHAR(strbuf, '\n')
12                         ) {
13 @@ -117,11 +117,11 @@
14                 }
15         } else {
16                 char *message = NULL;
17 -               int len = 1; /* for NUL */
18 +               int len = 0;
19                 int pos = 0;
20                 do {
21                         len += strlen(*argv) + 1;
22 -                       message = xrealloc(message, len);
23 +                       message = xrealloc(message, len + 1);
24                         sprintf(message + pos, " %s", *argv),
25                         pos = len;
26                 } while (*++argv);