From nobody Wed Oct 30 13:21:46 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 4XdnpM0QnBz5bM0r; Wed, 30 Oct 2024 13:21:47 +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 4XdnpL5LV2z4jdw; Wed, 30 Oct 2024 13:21:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730294506; 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=7a0tARKwQ6lyLgqeeY6g7Q/RTarAmakJdRqe6lAVYsY=; b=gSEtH69kcmdzsgxd3/NTQU71pCjgxqB2BMd4sSDjzOJs+V2fZmFfcbx7feTiXbXhJ8FEcx sBLJYLjbp79S1QiZWg/dgkiBAMwsrP5idccJwEeou2CLcWKaznEEFcQqD2BnBX/zRZbOeV nIrnjSnd44AZBftGHhkQKLx0L4jB9grzdlxJYPIXldFP2QBnlpd0G68DbL0ty0gt1hNAr+ UCSKYToLKzKlI0icfAzdaj7ilEQcLNyd91PgTiYyb3D88bol1mhZj/E0OZD89t0d9ljcu9 v4MAsQoQ3WEZYH2yGMl2bwhG9Lo09peONN4+LgBfjN5uCJb8241RY08YGfhP2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730294506; 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=7a0tARKwQ6lyLgqeeY6g7Q/RTarAmakJdRqe6lAVYsY=; b=J/yCmbLxJ9ocYlXusTwmC2bjqg64nhh4k0y+paO2lU4SS+oPKZnIyBxFOiUJkcM2f7wdOb jLB3yG8O82F48++hhnbMMdDlrbvE4uiM3HnJMv1Rr+CIkrsa8D2kNEuLprS3DI/S8urRuD Wo3ZBE8kH19tqZGVLMhqblvvX36Srcq3I/ShXQXv2Xyr4PWCMP8d5ULca7rO50Iy4YkU6x gGjevYnFmUVKKb+ITJyBvIpAQH051YrMvzdAp/Vmlt4z5iqNYrHGD2GgmWRy3GrHx3PPBs FXAIRWUmobA4v7rul8P58RrrD7o8aqfQAHIO1o4H9iO8i3LNkHqu0WlPNg8WaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730294506; a=rsa-sha256; cv=none; b=CyQjzbof3e/GKdshVecXDyh9N8BxCGInHN7ibYmp5BMAdeTqu2yjZNVkYR/IL8lvK40X96 lTdbFVNYMGxDX9clk1RYA+nwY2dR++Y+fcQ6JWILcDGO+svfM6ns2IjAHyIOrf8FO7lWSA Cj8z6xtlrd/LDTcbYGhLAk4LNj0sHhFu40O0IYRtCo8vrBO5GjJWcX1o2gXRp5h3RXakzf H6Et6Xwg1rzlYug8DKpjqS+4ZZG9fMMG6As9gCC3dosovjhb5NxLurqQQUC8qojIiLlPN/ eBlDrNRgtFtMYzMwkmDVHxChfPNyQ7p2z3km5vyME8nCZjdB2ef4Cgn4jS0DrA== 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 4XdnpL4yKHz17yg; Wed, 30 Oct 2024 13:21:46 +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 49UDLkoq088812; Wed, 30 Oct 2024 13:21:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49UDLkbp088809; Wed, 30 Oct 2024 13:21:46 GMT (envelope-from git) Date: Wed, 30 Oct 2024 13:21:46 GMT Message-Id: <202410301321.49UDLkbp088809@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: 390486cb25f9 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 390486cb25f9e4a2a3f592695bbdbffe5019e898 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=390486cb25f9e4a2a3f592695bbdbffe5019e898 commit 390486cb25f9e4a2a3f592695bbdbffe5019e898 Author: Mark Johnston AuthorDate: 2024-10-23 16:55:16 +0000 Commit: Mark Johnston CommitDate: 2024-10-30 13:21:31 +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 490398bf4a2e..cdd8d92ffefa 100644 --- a/sbin/devmatch/devmatch.c +++ b/sbin/devmatch/devmatch.c @@ -120,6 +120,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);