From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 878523858417; Wed, 19 Apr 2023 23:34:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 878523858417 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] buffer overflow in print_symname X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 3cae258044e8d45895ef9b0cce5d8fc7b9c3dd1d X-Git-Newrev: 685b44ee816c6e508d282ae3766f2441b5ae9334 Message-Id: <20230419233435.878523858417@sourceware.org> Date: Wed, 19 Apr 2023 23:34:35 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2023 23:34:35 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D685b44ee816c= 6e508d282ae3766f2441b5ae9334 commit 685b44ee816c6e508d282ae3766f2441b5ae9334 Author: Alan Modra Date: Wed Apr 19 21:53:18 2023 +0930 buffer overflow in print_symname =20 * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Zero terminate string sections. Diff: --- bfd/ecoff.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 =20 + /* Ensure string sections are zero terminated. */ + if (debug->ss) + debug->ss[internal_symhdr->issMax - 1] =3D 0; + if (debug->ssext) + debug->ssext[internal_symhdr->issExtMax - 1] =3D 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