Fix syslog buffer overflow (Bug#270, reported by Kevin Jordan)

This commit is contained in:
David van Moolenbroek 2009-10-01 16:54:56 +00:00
parent cb50e7e135
commit 0c1ae1965e

View file

@ -139,7 +139,7 @@ void syslog(int lprty, const char *msg,...)
len += sprintf(buff + len, "[%d]: ", LogPid);
}
va_start(ap, msg);
len += vsprintf(buff + len, msg, ap);
len += vsnprintf(buff + len, sizeof(buff) - len, msg, ap);
va_end(ap);
rc = write(nfd, buff, len);
if ((rc != len && LogFlags & LOG_CONS) || LogFlags & LOG_PERROR) {