From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 39D3A15838C for ; Thu, 25 Jan 2024 05:57:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 83F63E2A32; Thu, 25 Jan 2024 05:57:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5613EE2A32 for ; Thu, 25 Jan 2024 05:57:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A40C33433EB for ; Thu, 25 Jan 2024 05:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 46649EC0 for ; Thu, 25 Jan 2024 05:57:49 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1706161823.0b5d5d35b7b745dfff588579cda1245c5a4d19cb.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: paxelf.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 0b5d5d35b7b745dfff588579cda1245c5a4d19cb X-VCS-Branch: master Date: Thu, 25 Jan 2024 05:57:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b1a75e98-8877-4e4c-a9f4-4ea0e23bd7ea X-Archives-Hash: 2f3757b24af5b1f4cf05292623b278d3 commit: 0b5d5d35b7b745dfff588579cda1245c5a4d19cb Author: Mike Frysinger gentoo org> AuthorDate: Thu Jan 25 05:50:23 2024 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Jan 25 05:50:23 2024 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=0b5d5d35 paxelf: reject ELFs with incomplete Ehdr structures There's nothing useful we can parse out of these, so skip them. Signed-off-by: Mike Frysinger gentoo.org> paxelf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/paxelf.c b/paxelf.c index 9a34ea4..599d54f 100644 --- a/paxelf.c +++ b/paxelf.c @@ -620,6 +620,11 @@ free_elf_and_return: char invalid; \ const Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ Elf ## B ## _Off size; \ + /* Need enough bytes for all of ehdr. */ \ + if (elf->len < (off_t)sizeof(*ehdr)) { \ + warn("%s: Incomplete ELF header", filename); \ + goto free_elf_and_return; \ + } \ /* verify program header */ \ invalid = 0; \ if (EGET(ehdr->e_phnum) <= 0) \