From nobody Wed Oct 30 13:21:12 2024 X-Original-To: dev-commits-src-all@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 4Xdnnh6h0Yz5bMDJ; Wed, 30 Oct 2024 13:21:12 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xdnnh664Pz4j2F; Wed, 30 Oct 2024 13:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730294472; 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=fvA0vyOXld+qR4/bxIz8DqA9Ki2Bt7ijaVlcFq0l3vw=; b=NN7Irbv/V4m0LyqQRX7gZtp2p5q6UjOjY/w7pHtVgNujbRteUiuxmaG573VcOHDmWSsckp UHGlzqlO4M4pmwCjnqF7ZAaQgrLABnS+CDQvzEcv9EctkYWYCO7V17zZ3GqUFBRTzXgTeW 8ak4fV/89ZrC/HKVxp47xw384uiM6HublHFHKjrJiHdGVTfccfWxD6VdIHSdH+TqamM/Ow wBN274RGfuWdyzaS3NJVAnUOU3zTXNAughIGtugDA+/xzuVCPNQ2RgQ5wkw/QwRhmrjNFu dbytiw8gILz5LV/Mt5eT4zUR3hzSUv5OH2mIlWMnrP9yOEpXDHcmLxgg6zZJkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730294472; 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=fvA0vyOXld+qR4/bxIz8DqA9Ki2Bt7ijaVlcFq0l3vw=; b=AgUY5s+YYuJ6OOHIeoQkqrMgLp+v6rXK11c0JzabJiRw9NxKcqLlGiKXZPdR9CQg773vGD aZoeKaSoZiUEDoAZRlP9LUQ7KSwyrYxPFeKxQJmbyItE0JA567AD9lfBw9JZmyf3vu7tzG fYV4QRTi0gy93ma9IQXpHKKA3VDNCNQZENEwZ6Gl1Y2U/GEdv5Fkqn54t8vOi4Xs/e6wPi 0V8muPFwn4ibl0sqtQNIpD0PRomsTJcqvalrD2jneBXtxmoPYGs3z241+ooeS5eCi7GA5t DtT84hsjGY5yDiGf5OIJ1tewi6GtfqLdUYooxEY+xosrdFKQl4QXoNcmD/oSZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730294472; a=rsa-sha256; cv=none; b=WXyHS+TcwUca2azkX8VpMnjT99BSDgnRWAUaZgWweUa6rjrN4kKRhefbb1RgPsLJlZUUDe dg1qUuhKzcS/dq23poyQ3aLkHuzKKRs4cs1V6V8+HQIvzHJ6tOFZVRs25msbvup3oryIcS ZnEcFhw+Hze6Mpuz9G1JU2BuId6dPO/BYEUrfOO7jmdPvreMRUcATuR8nzGmecckrWipxU NfcEDYElw8Ic0hbB9YhGs6Zm0yjjxf8XNYWR33O/splYC4t0sZo7UTG88+eRtrDjDCwDAI VVbZ+ic6a3d9VUj2h1YHFQZzaVWKdmb/ddIYlLo2abplK2zaOuKqZpmkyFZsvA== 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 4Xdnnh5jYSz17sJ; Wed, 30 Oct 2024 13:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49UDLCPl087546; Wed, 30 Oct 2024 13:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49UDLCRX087543; Wed, 30 Oct 2024 13:21:12 GMT (envelope-from git) Date: Wed, 30 Oct 2024 13:21:12 GMT Message-Id: <202410301321.49UDLCRX087543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 4990a7d344d9 - stable/14 - devmatch: Catch truncated linker hints files List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4990a7d344d985668917d00cde0675c042cd5649 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4990a7d344d985668917d00cde0675c042cd5649 commit 4990a7d344d985668917d00cde0675c042cd5649 Author: Mark Johnston AuthorDate: 2024-10-23 16:55:16 +0000 Commit: Mark Johnston CommitDate: 2024-10-30 13:21:06 +0000 devmatch: Catch truncated linker hints files PR: 282268 Reviewed by: christos, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47243 (cherry picked from commit 9b2f2fbfcbc51f77e96a41e62b1c06a8ccd4ca15) --- sbin/devmatch/devmatch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c index 2485120c57b6..d961a1e92daa 100644 --- a/sbin/devmatch/devmatch.c +++ b/sbin/devmatch/devmatch.c @@ -127,6 +127,12 @@ read_linker_hints(void) err(1, "Can't open %s for reading", fn); } + if (len < sizeof(int)) { + warnx("Linker hints file too short."); + free(hints); + hints = NULL; + return; + } if (*(int *)(intptr_t)hints != LINKER_HINTS_VERSION) { warnx("Linker hints version %d doesn't match expected %d.", *(int *)(intptr_t)hints, LINKER_HINTS_VERSION);