diff options
author | brian <brian@FreeBSD.org> | 2001-08-20 13:24:39 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-08-20 13:24:39 +0000 |
commit | d48c427cd5bdebd62fe29b534bab868f697332da (patch) | |
tree | cfffe027302e0b8a140748c6626dc30e92913ec1 /usr.sbin/syslogd/syslogd.c | |
parent | 016b1a255a4619a8b85d12e8ef931c0dfa1e13ae (diff) | |
download | FreeBSD-src-d48c427cd5bdebd62fe29b534bab868f697332da.zip FreeBSD-src-d48c427cd5bdebd62fe29b534bab868f697332da.tar.gz |
Handle snprintf() returning -1.
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 3ff3233..3866d73 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -901,7 +901,8 @@ fprintlog(f, flags, msg) v->iov_len = snprintf(greetings, sizeof greetings, "\r\n\7Message from syslogd@%s at %.24s ...\r\n", f->f_prevhost, ctime(&now)); - v++; + if (v->iov_len > 0) + v++; v->iov_base = ""; v->iov_len = 0; v++; @@ -995,7 +996,9 @@ fprintlog(f, flags, msg) else l = snprintf(line, sizeof line - 1, "<%d>%.15s %s", f->f_prevpri, iov[0].iov_base, iov[5].iov_base); - if (l > MAXLINE) + if (l < 0) + l = 0; + else if (l > MAXLINE) l = MAXLINE; if (finet) { |