From f928e40e98089d70cbeba0d898bff05961531418 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Sat, 28 Jul 2007 22:42:00 -0600 Subject: [PATCH] fix logger.c the rest of the way --- misc-utils/logger.c | 2 ++ 1 file changed, 2 insertions(+) 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 */ -- 2.39.5