From patchwork Wed Apr 19 23:05:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 85638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp719239vqo; Wed, 19 Apr 2023 16:05:32 -0700 (PDT) X-Google-Smtp-Source: AKy350a9IcqxZP0hlxkTocnqrwwUA0wMMvhIN1c2U9909jA7qyqUqmj4o0U1Ofd+j0ATFAQZvOvb X-Received: by 2002:a17:906:a194:b0:94e:75f8:668 with SMTP id s20-20020a170906a19400b0094e75f80668mr16135954ejy.56.1681945532349; Wed, 19 Apr 2023 16:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681945532; cv=none; d=google.com; s=arc-20160816; b=fNcgZQrmG22S9okynZ0Ey4C+1RMLURXo+2J7PAX2bK2WtaI9exN4ySA62IIqXtzPt2 ml44NCSaal4IR879x5M/HK+OxEUn7Ag1lqPp1f419L6gDXGFp5BkdsijsjFQAqk3q7A0 ptF8X09A8LXJQFEfZkbgoOaSnetR+EsUlXRJ/ku9tz7wUsZCOqBfu6Ql10c+gWRi18oi sbAwJQZHCyuP0Yz+FyH69kbehqBSLBb49aLW+wRiPA0qXqWccxb39++AxCQddLiq3iQW HXPxb6Co2dE9a1uI7rhq5RkWhannq8CbhtPP7ETjWGXyNpdc7nZ1u5ofesvEZsjoYkqT hkLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=nwtg2MMOw3WB+Gd1hI13XKtLGxeG4eRnq+S2AzQkszU=; b=K2fIAdLcf7jXKQhALMyPcv+30zNZHU06Inwb3kN2aOokbp8mmRWxogYuNRrr8RftS+ zu0t76Z6yP8VDRz2+JC7/sSt/E57Pt91zmmqvxXyyvFLbcJAZswIOuABN3Y+IFipj6zi LFFY3msZjX5tWoHxvIO2/PaYbmH+9UdTS20mXK/tNVAeFak+BGRrNwuucL0G9Uwfv5Eo xaHVaWx+jnNd+ypWWHHEsfDTyINIzIZKX4eZpELtC21noikyb04GW/eRTst8ScXzz6An uridW/0fU1N5hblMCHAxRqXd+X9TwldknrxP0PdVrwXJLSl3CbPQjRMzNTorOkAW7KHY 86Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jcuv7DND; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b21-20020a17090630d500b0094f310cd646si66521ejb.219.2023.04.19.16.05.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 16:05:32 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jcuv7DND; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07AB93858422 for ; Wed, 19 Apr 2023 23:05:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07AB93858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681945531; bh=nwtg2MMOw3WB+Gd1hI13XKtLGxeG4eRnq+S2AzQkszU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jcuv7DND2Eo/bWHXpCo7FVr9IUe/gDGefX5m5zeHYwNpov1H3G7Ej6s/gSHxxWM9a Atzs/drGkeJzwv6j6Twp1g7zDwIpVVK9XDxOSCTiPHXdmIWelYyF3gFpGZ3c2XPS7L 5y5Lu8TiyaQDYNShZUkPpv3cWiua9qIlGajlrpBQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 703CD3858CDA for ; Wed, 19 Apr 2023 23:05:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 703CD3858CDA Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-24b3451b2fcso215979a91.3 for ; Wed, 19 Apr 2023 16:05:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681945520; x=1684537520; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nwtg2MMOw3WB+Gd1hI13XKtLGxeG4eRnq+S2AzQkszU=; b=LGSR7xj38SJiRC1v2dDYBlDRsRhxkyDqwkKT0ec9RFYqPQ28GOZSch88Dq1H6aduX3 DYuqzsIA2PwRd6ntejGiYtGxzqaw71gcexqVenXBlV+5H/ZnnzIIakkoePst/Zs2a4jX D6DdhoClhPDPBLeRoP9slSoWGajtX04oQ6V61U0kZKL3ZGz4CRcgZ53sFp5S3sRvQzd2 EhVG+ivZn2oDU+XjSIGAt3GeX0yywGISvx19ZcgPGLzLmELCI72ccRmdGnMGHmFbzxVk uHBG0SMJ160mYrsNRmymhTLAQJ7HzTmGrpGv36oLSinlC83cp6oUBiUShdvTvHd0lWcV AuBQ== X-Gm-Message-State: AAQBX9fUc6tJLDHwCal57q0dzpsb2WXlchAvrIBKkt4bHWxoW20XTwxU EXyQrVZzemaaeA89XBOrXmEVhYJWSeU= X-Received: by 2002:a17:90a:9909:b0:23f:6d4e:72b3 with SMTP id b9-20020a17090a990900b0023f6d4e72b3mr1419565pjp.25.1681945519993; Wed, 19 Apr 2023 16:05:19 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:49d0:c85a:52c0:93b9]) by smtp.gmail.com with ESMTPSA id ls17-20020a17090b351100b0023a9564763bsm1881463pjb.29.2023.04.19.16.05.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 16:05:19 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id C37641142CAE; Thu, 20 Apr 2023 08:35:15 +0930 (ACST) Date: Thu, 20 Apr 2023 08:35:15 +0930 To: binutils@sourceware.org Subject: buffer overflow in print_symname Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763647718350715880?= X-GMAIL-MSGID: =?utf-8?q?1763647718350715880?= * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Zero terminate string sections. diff --git a/bfd/ecoff.c b/bfd/ecoff.c index fb6fcade913..676b8d84017 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -599,6 +599,12 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, FIX (cbExtOffset, iextMax, external_ext, void *); #undef FIX + /* Ensure string sections are zero terminated. */ + if (debug->ss) + debug->ss[internal_symhdr->issMax - 1] = 0; + if (debug->ssext) + debug->ssext[internal_symhdr->issExtMax - 1] = 0; + /* I don't want to always swap all the data, because it will just waste time and most programs will never look at it. The only time the linker needs most of the debugging information swapped