bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inetutils-1.4.0: syslogd crashes on boot, have fix


From: Michael Deutschmann
Subject: inetutils-1.4.0: syslogd crashes on boot, have fix
Date: Fri, 16 Aug 2002 06:51:28 -0700 (PDT)

I found that your version of syslogd reliably crashes while processing
the 2-3k of queued kernel messages available at first startup.

Some investigation revealed that the problem was in the code that deals
with long data blocks from /proc/kmsg.  Your code first places a sentinel
0 at the end of the buffer, then uses strchr to split on '\n', handing the
left side to further processing and memmove()ing the right side over to
the left.

However, the memmove() command as written does not move the sentinel byte
-- as a result the strchr() can scan past the valid data and lock onto a
'\n' there.  If this happens the next call of memmove will have a negative
length, causing a segfault (and some rather distorted log messages).

The fix is simple -- extending the length of the memmove by 1 copies the
sentinel byte too.

---- Michael Deutschmann <address@hidden>

Patch follows:

--- syslogd.c.O 2002-04-29 14:18:10.000000000 -0700
+++ syslogd.c   2002-08-16 04:32:01.000000000 -0700
@@ -718,7 +718,7 @@
                        *(eol++) = '\0';
                        printsys (kline);
                        kline_len -= (eol - kline);
-                       memmove (kline, eol, kline_len);
+                       memmove (kline, eol, kline_len + 1);
                      }
                    if (kline_len == sizeof (kline) - 1)
                      /* Log the beginning of a partial line.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]