[BusyBox] syslogd bug

Matt Kraai kraai at alumni.carnegiemellon.edu
Mon Dec 11 19:58:55 UTC 2000


Howdy,

The attached patch should prevent syslogd from segfaulting when it
receives a message of unknown priority.  The array of names is
terminated by a NULL, not by the empty string, and derefencing the
NULL will cause a segfault.  Normally I'd commit this, but since we
are approaching a release, I'll wait for word from on high.

Matt
-------------- next part --------------
Index: syslogd.c
===================================================================
RCS file: /var/cvs/busybox/syslogd.c,v
retrieving revision 1.49
diff -u -r1.49 syslogd.c
--- syslogd.c	2000/12/11 19:28:29	1.49
+++ syslogd.c	2000/12/11 19:45:47
@@ -143,7 +143,7 @@
 				c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3); c_fac++);
 		for (c_pri = prioritynames;
 				c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
-		if (*c_fac->c_name == '\0' || *c_pri->c_name == '\0')
+		if (c_fac->c_name == NULL || c_pri->c_name == NULL)
 			snprintf(res, sizeof(res), "<%d>", pri);
 		else
 			snprintf(res, sizeof(res), "%s.%s", c_fac->c_name, c_pri->c_name);


More information about the busybox mailing list