svlogd: fix buffer overrun
No binary (build failed)
gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -Iinclude -o applets/usage applets/usage.c
(log yok)
| @@ -244,7 +244,7 @@ struct globals { | |
| #define INIT_G() do { \ | |
| setup_common_bufsiz(); \ | |
| SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ | |
| - | linemax = 1000; \ |
| + | linemax = COMMON_BUFSIZE - 26; \ |
| /*buflen = 1024;*/ \ | |
| linecomplete = 1; \ | |
| replace = ""; \ | |
| @@ -1069,7 +1069,7 @@ int svlogd_main(int argc, char **argv) | |
| } | |
| if (opt & 2) if (!repl) repl = '_'; // -R | |
| if (opt & 4) { // -l | |
| - | linemax = xatou_range(l, 0, COMMON_BUFSIZE-26); |
| + | linemax = xatou_range(l, 0, COMMON_BUFSIZE - 26); |
| if (linemax == 0) | |
| linemax = COMMON_BUFSIZE-26; | |
| if (linemax < 256) | |