From owner-dev-commits-src-branches@freebsd.org Tue Jun 8 10:27:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE12265D40A; Tue, 8 Jun 2021 10:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fzmd15qnmz3tbR; Tue, 8 Jun 2021 10:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B04B1271A2; Tue, 8 Jun 2021 10:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 158AR1UE021817; Tue, 8 Jun 2021 10:27:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 158AR1iF021816; Tue, 8 Jun 2021 10:27:01 GMT (envelope-from git) Date: Tue, 8 Jun 2021 10:27:01 GMT Message-Id: <202106081027.158AR1iF021816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 90e161ec6d11 - stable/11 - ng_parse: IP address parsing in netgraph eating too many characters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 90e161ec6d1127f30f92bf0b8c59dd4bd5a8bc26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2021 10:27:01 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=90e161ec6d1127f30f92bf0b8c59dd4bd5a8bc26 commit 90e161ec6d1127f30f92bf0b8c59dd4bd5a8bc26 Author: Markus Stoff AuthorDate: 2021-05-18 20:35:33 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-08 10:26:09 +0000 ng_parse: IP address parsing in netgraph eating too many characters Once the final component of the IP address has been parsed, the offset on the input must not be advanced, as this would remove an unparsed character from the input. Submitted by: Markus Stoff Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D26489 (cherry picked from commit 63b6a08ce2467b8e230e7a4ecb3e1ddf1b48851c) --- sys/netgraph/ng_parse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c index b08cecd102e9..7297756c796d 100644 --- a/sys/netgraph/ng_parse.c +++ b/sys/netgraph/ng_parse.c @@ -961,9 +961,11 @@ ng_ipaddr_parse(const struct ng_parse_type *type, if ((error = ng_int8_parse(&ng_parse_int8_type, s, off, start, buf + i, buflen)) != 0) return (error); - if (i < 3 && s[*off] != '.') - return (EINVAL); - (*off)++; + if (i < 3) { + if (s[*off] != '.') + return (EINVAL); + (*off)++; + } } *buflen = 4; return (0);