From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 4A5463857C67 for ; Wed, 16 Feb 2022 11:32:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A5463857C67 Received: by mail-pf1-x431.google.com with SMTP id z16so1919400pfh.3 for ; Wed, 16 Feb 2022 03:32:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=H9pr7a16jnXiIpFpq4ohQvJ2JgwGCMYrz1Y5JfsACr4=; b=q/avRmcR+jqmT1PFi0TKJiyLX2cFPCZEgaEfbGgmnXppZ6sZiRSCFrUgRtzSJEdbz+ JD7vl1uD3uUsQwI1G0ITY3fKQjIospaR90MUHElzPBVpdEuZ7Ww06tIn+OEPysQAbM6M pvP1TWrmaY6BWXIEAnl8YU9Pr0vdMQG3Fd60Fl7DpwoU4iPuV/Hf7Jb8Rk+FRnNDDcvw hfC91MPQRkE1Chp2Ag5nC+VByDq/WxrZyr7NQtP/x45dwU+1F3/wg+W+Z5hsEy77FA0+ ROniFCLRzKoZErFHS21nMgEClLPGpnl+vQ4RVRlPuXDMwqYDddT/MNMzEotQTEeUKqFq 3U/w== X-Gm-Message-State: AOAM5322/bl8QRc9TjZLx83trK4eTE0RzGk1Ur+CvpQgMp04TIFlUOIp K/K8RC4CUrP8eEM0IDF9tf4a8tyr/kw= X-Google-Smtp-Source: ABdhPJy5KbXA8nPU4gvsQ1e1MPpnfk8URH2Vre6RpPkAq1vQzAqWApOREKFYyMm/RSknb+9am2qc4g== X-Received: by 2002:a05:6a00:2391:b0:4a8:d88:9cd with SMTP id f17-20020a056a00239100b004a80d8809cdmr2462599pfc.11.1645011123003; Wed, 16 Feb 2022 03:32:03 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:5250:e0c3:7fe9:a164]) by smtp.gmail.com with ESMTPSA id g19sm25859684pfc.109.2022.02.16.03.32.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 03:32:02 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 6FB181140F2B; Wed, 16 Feb 2022 22:01:59 +1030 (ACDT) Date: Wed, 16 Feb 2022 22:01:59 +1030 From: Alan Modra To: binutils@sourceware.org Subject: asan: buffer overflow in vms-alpha.c Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3037.0 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 16 Feb 2022 11:32:06 -0000 * vms-alpha.c (evax_bfd_print_dst): Sanity check another place printing strings. diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index c8250e2a673..06fa891ac70 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -7390,7 +7390,9 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int dst_size, FILE *file) fprintf (file, _("standard data: %s\n"), evax_bfd_get_dsc_name (type)); evax_bfd_print_valspec (buf, len, 4, file); - fprintf (file, _(" name: %.*s\n"), buf[5], buf + 6); + if (len > 6) + fprintf (file, _(" name: %.*s\n"), + buf[5] > len - 6 ? len - 6 : buf[5], buf + 6); break; case DST__K_MODBEG: { -- Alan Modra Australia Development Lab, IBM