--- logger.c 2007-04-10 11:51:37.799608864 -0500 +++ logger.c 2007-04-10 11:50:59.895248864 -0500 @@ -58,6 +58,10 @@ static int optd = 0; +#ifndef MAX_MSG_LEN +#define MAX_MSG_LEN 16384 +#endif + static int myopenlog(const char *sock) { int fd; @@ -85,13 +89,12 @@ static void mysyslog(int fd, int logflags, int pri, char *tag, char *msg) { - char buf[1000], pid[30], *cp, *tp; + char buf[MAX_MSG_LEN], pid[30], *cp, *tp; time_t now; if (fd > -1) { - /* avoid snprintf - it does not exist on ancient systems */ if (logflags & LOG_PID) - sprintf (pid, "[%d]", getpid()); + snprintf (pid, 30, "[%d]", getpid()); else pid[0] = 0; if (tag) @@ -104,8 +107,7 @@ (void)time(&now); tp = ctime(&now)+4; - /* do snprintf by hand - ugly, but for once... */ - sprintf(buf, "<%d>%.15s %.200s%s: %.400s", + snprintf(buf, MAX_MSG_LEN, "<%d>%s %s%s: %s", pri, tp, cp, pid, msg); if (write(fd, buf, strlen(buf)+1) < 0) @@ -122,7 +124,7 @@ int main(int argc, char **argv) { int ch, logflags, pri; - char *tag, buf[1024]; + char *tag, buf[MAX_MSG_LEN]; char *usock = NULL; int LogSock = -1;