From owner-svn-src-head@freebsd.org Mon Jun 18 06:01:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CACB510184A2; Mon, 18 Jun 2018 06:01:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CBBF70218; Mon, 18 Jun 2018 06:01:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0992021A; Mon, 18 Jun 2018 06:01:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5I61T5s016613; Mon, 18 Jun 2018 06:01:29 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5I61TXB016612; Mon, 18 Jun 2018 06:01:29 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201806180601.w5I61TXB016612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 18 Jun 2018 06:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335314 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 335314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 06:01:30 -0000 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. */