From nobody Mon Aug 07 03:49:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RK2Q819zHz4pyqd; Mon, 7 Aug 2023 03:49:52 +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 4RK2Q80kL6z4Lcx; Mon, 7 Aug 2023 03:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691380192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DrLpLQXGKwzb7yTXkeXrL+fqpU7TCpul0LiORiAC1yM=; b=a4U1tS/I5XhrVQ2HQ/cvZNrNJX94J0iOKGp6zD3qpNI41poVns0zk6PhekVPjoFL8eG2bk F8CUwg4puLD5htC9Om0ePX+rEzYlMHE3DaD6+jLKA8F5f+fqsS4SH7TPSTOFAiAoGY2FhL IQ1bfxUvFvg+IVlzmsS4qzkcBFR89porzMWfNDKqHx+cKGW5koAnFVKOhYDsT5yJAbJkkd 6Af8jdV7bvkCsSp+fFoS9UTf+t1siFJq7CPfLigHWTDorZAXL+5Smkwz/6LWqiuaM9nbSt 1uN5Umdg5Ri7y5DwVfyqOO988arQs4VfYDTFdaQUBLcQQCOFlYw2N7IpFPBVlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691380192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DrLpLQXGKwzb7yTXkeXrL+fqpU7TCpul0LiORiAC1yM=; b=pN6KP16IOs+U5k0DIYhfvcN5enmBEz339ng8NT7arrJFhyxSJEI0yKDd06E7JphZHLDlxH z2K1U1rGLeJti342AcvZnZm/elEGN3ZQ2uD4IhDTxj96lrWf50ZLKTd/hD5pQeVVTWKrVr f6KdcQHdhipnXAVXuZXM/mUoIc1MFLjFMzYh9LDxtnMNlt0wj7bPVB7HzDSMP3Vq0WDnLB 7aD6FooJb03ddfRPQiFcGzzZ+G59Il/Uqy+CU+wmDXTVNB0TXTIKvq8jRvglFhiP+GJQlh mP71UwzqFS4AbAqwEdzQwqggWt77KwMW4D89ocjRh9VyQMryjEKJgCv6KDe0gA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691380192; a=rsa-sha256; cv=none; b=gnblVZfZJn+X1LlM1LGSPE6bhlszvSUS7+UHdnrFdHwb9GGiJVO+5fyun2QPiVoJcqAATX +72p0VtNKavOIA5IXx04fwbgso2IgPsUp517uzQvOiSa1cxzuAna6z6eSTDG73b1OI9JpZ YmVV2MT2X/VFZHujNBysDzItYyOERDtjLfMYUJRq91QC4Eszljr7gC4yyCJH6eopfnk/Y3 6AGuPkz1TaOX/pU8fPcZFqYGsqUgBBQUSNqyzdvFkcrqhdwCnkXM1nI5/QK+BSVEdYfm3S xOQ2zMgT5cEKpbG34+jbmO0KsQvvnS43rdnzSz6Ijx5ZBYk5qjUoW5BRyFLLmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RK2Q76wZQzdCB; Mon, 7 Aug 2023 03:49:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3773npuq062058; Mon, 7 Aug 2023 03:49:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3773nppG062057; Mon, 7 Aug 2023 03:49:51 GMT (envelope-from git) Date: Mon, 7 Aug 2023 03:49:51 GMT Message-Id: <202308070349.3773nppG062057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Pedro F. Giffuni" Subject: git: 9610cbc09e72 - main - patch: don't run off the end of path if it ends in '/'. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pfg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9610cbc09e72c370369b5cc0e165542a2c5fdca7 Auto-Submitted: auto-generated The branch main has been updated by pfg: URL: https://cgit.FreeBSD.org/src/commit/?id=9610cbc09e72c370369b5cc0e165542a2c5fdca7 commit 9610cbc09e72c370369b5cc0e165542a2c5fdca7 Author: Pedro F. Giffuni AuthorDate: 2023-08-07 03:27:27 +0000 Commit: Pedro F. Giffuni CommitDate: 2023-08-07 03:27:27 +0000 patch: don't run off the end of path if it ends in '/'. Found by fuzzing (afl) in OpenBSD. Obtained from: OpenBSD (CVS 1.65) --- usr.bin/patch/pch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index d1d71f95644c..e180c7075712 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1618,7 +1618,8 @@ num_components(const char *path) size_t n; const char *cp; - for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++, cp++) { + for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++) { + cp++; while (*cp == '/') cp++; /* skip consecutive slashes */ }