svlogd: fix buffer overrun
Patch by mjmouse9999@gmail.com When running svlogd -tt with a long line of input, the code assumes a buffer of at least linemax+26 length, but that is two bytes longer than the actual buffer with the default of linemax = 1000. fixing that. No code size change. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
1 parent
71f9960b33
commit
cd8427b8ec
1 file changed
+2
-2
+2
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user