Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2018 16:12:31 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335492 - stable/11/usr.sbin/syslogd
Message-ID:  <201806211612.w5LGCVJZ099303@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806211612.w5LGCVJZ099303>