From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-24b3451b2fcso215979a91.3 for ; Wed, 19 Apr 2023 16:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681945520; x=1684537520; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=nwtg2MMOw3WB+Gd1hI13XKtLGxeG4eRnq+S2AzQkszU=; b=lct3FrWFeLrzhVLkzP6p2sRfLW6Lt0jPAKYk9y1Od2J+4iaRk+eNHZZwR0UP6z9u+T ogmfAnJN9Kp5vV3DjTeAuOcCdU1brfOhpbzbZ1yXQErtYS4BVSrW/4D0b68hD/aFXa1r egGIXBG9dwBDff5ororCyM8TCcvIp5G1ujweuK6qo9LFDBPVCwBbNPzxm07hSCopb1NM yZ6I0QYRi1T6fp3R4TqWbzL9SZUJOaUYDez8/j7WvK5YwFas6nGbUcC4CwdNOd69s5fz IIQg3Gn7LD4p91vljVHY/CpDrnlZ5Zlr28wgm9guZqb5qzQQ6Kmf+pFJTG59O/KFnkOm g+Hw== 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-Google-Smtp-Source: AKy350aPaDMkf3IbZy+IghE5Hmxt9+/J95izf5eT2iA2ix+bIquHEBzwHmuEvzasAYH85enqeOTxcA== 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 From: Alan Modra To: binutils@sourceware.org Subject: buffer overflow in print_symname Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 List-Id: * 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 -- Alan Modra Australia Development Lab, IBM