[PATCH] svlogd: fix buffer overrun
mjmouse9999
mjmouse9999 at gmail.com
Sun Jun 21 11:50:16 UTC 2026
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.
My example is:
head -c1000 /dev/zero | tr '\0' 'a' | svlogd -tt directory
which results in a segmentation fault on my testing system (x86_64-v2).
Alternative workaround for already-built busyboxes is to always include
the -l parameter when running svlogd with any -t parameter.
diff --git a/runit/svlogd.c b/runit/svlogd.c
index f7576f0fa..5473a2d06 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 = ""; \
More information about the busybox
mailing list