Date: Mon, 18 Jun 2018 06:01:29 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335314 - head/usr.sbin/syslogd Message-ID: <201806180601.w5I61TXB016612@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Mon Jun 18 06:01:28 2018 New Revision: 335314 URL: https://svnweb.freebsd.org/changeset/base/335314 Log: Fix bad logic in iovlist_truncate(). To conform to RFC 5426, this function is intended to truncate messages if they exceed the message size limits. Unfortunately, the amount of space was computed the wrong way around, causing messages to be truncated entirely. Reported by: Michael Grimm on stable@ MFC after: 3 days Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Mon Jun 18 04:58:48 2018 (r335313) +++ head/usr.sbin/syslogd/syslogd.c Mon Jun 18 06:01:28 2018 (r335314) @@ -1613,8 +1613,8 @@ iovlist_truncate(struct iovlist *il, size_t size) struct iovec *last; size_t diff; - while (size > il->totalsize) { - diff = size - il->totalsize; + while (il->totalsize > size) { + diff = il->totalsize - size; last = &il->iov[il->iovcnt - 1]; if (diff >= last->iov_len) { /* Remove the last iovec entirely. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806180601.w5I61TXB016612>