From: LaMont Jones Date: Sun, 29 Jul 2007 04:42:00 +0000 (-0600) Subject: fix logger.c the rest of the way X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f928e40e98089d70cbeba0d898bff05961531418;p=util-linux fix logger.c the rest of the way --- diff --git a/misc-utils/logger.c b/misc-utils/logger.c index ae23e347..40db42b5 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -91,6 +91,7 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) { if (fd > -1) { if (logflags & LOG_PID) snprintf (pid, sizeof(pid)-1, "[%d]", getpid()); + pid[sizeof(pid)-1]=0; else pid[0] = 0; if (tag) @@ -105,6 +106,7 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) { snprintf(buf, sizeof(buf)-1, "<%d>%.15s %.200s%s: %.400s", pri, tp, cp, pid, msg); + buf[sizeof(buf)-1]=0; if (write(fd, buf, strlen(buf)+1) < 0) return; /* error */