[git commit] svlogd: fix buffer overrun
Denys Vlasenko
vda.linux at googlemail.com
Fri Jul 3 06:17:51 UTC 2026
commit: https://git.busybox.net/busybox/commit/?id=cd8427b8ec76d212343af8725f1bed24053d087e
branch: https://git.busybox.net/busybox/log/?h=master
Patch by mjmouse9999 at 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 at googlemail.com>
---
runit/svlogd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runit/svlogd.c b/runit/svlogd.c
index f7576f0fa..2a412f466 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -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)
More information about the busybox-cvs
mailing list