svn commit: r335492 - stable/11/usr.sbin/syslogd

Ed Schouten ed at FreeBSD.org
Thu Jun 21 16:12:31 UTC 2018


Author: ed
Date: Thu Jun 21 16:12:30 2018
New Revision: 335492
URL: https://svnweb.freebsd.org/changeset/base/335492

Log:
  MFC r335314:
  
    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@

Modified:
  stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/11/usr.sbin/syslogd/syslogd.c	Thu Jun 21 15:59:05 2018	(r335491)
+++ stable/11/usr.sbin/syslogd/syslogd.c	Thu Jun 21 16:12:30 2018	(r335492)
@@ -1611,8 +1611,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. */


More information about the svn-src-all mailing list