From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id A4F183861001; Wed, 24 Apr 2024 01:39:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4F183861001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713922777; bh=nehEyuV7xviZUGA5wS5iWk4+axKFV2jBwx6j5zt+xBk=; h=From:To:Subject:Date:From; b=HhuVn7C+x10HIdVaqbwgItvpai9IWy6M4vsuJWRqgAZNYkEqg7X0E/VZgiy3/pero BSRo7FPeaGTqaycRKRc2zEwm0qBZGZPSlIRFSD6c2dvF3ezqLBTyNpinBr8p1269Wd F43zapto5LFwGDUHuJ+qDmkgf6qMLGfPIfh7acfE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: binutils-cvs@sourceware.org Subject: [binutils-gdb] buffer overflow in libctf tests X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: d65decae83c64c0301f8207bb0bf14ffd11f67b7 X-Git-Newrev: 122f6f14b135480b184091bf2037ea133beedc54 Message-Id: <20240424013937.A4F183861001@sourceware.org> Date: Wed, 24 Apr 2024 01:39:37 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D122f6f14b135= 480b184091bf2037ea133beedc54 commit 122f6f14b135480b184091bf2037ea133beedc54 Author: Alan Modra Date: Wed Apr 24 09:30:24 2024 +0930 buffer overflow in libctf tests =20 * testsuite/libctf-regression/gzrewrite.c (main): Don't overflow "a" buffer in "after adding types" check. * testsuite/libctf-regression/zrewrite.c (main): Likewise. Diff: --- libctf/testsuite/libctf-regression/gzrewrite.c | 2 +- libctf/testsuite/libctf-regression/zrewrite.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libctf/testsuite/libctf-regression/gzrewrite.c b/libctf/testsu= ite/libctf-regression/gzrewrite.c index 99722200950..2e679e85bfe 100644 --- a/libctf/testsuite/libctf-regression/gzrewrite.c +++ b/libctf/testsuite/libctf-regression/gzrewrite.c @@ -114,7 +114,7 @@ main (int argc, char *argv[]) if ((b =3D read_gz ("tmpdir/two.gz", &b_len)) =3D=3D NULL) goto read_err; =20 - if (memcmp (a, b, b_len) =3D=3D 0) + if (a_len =3D=3D b_len && memcmp (a, b, b_len) =3D=3D 0) { fprintf (stderr, "gzwrites after adding types does not change the di= ct\n"); return 1; diff --git a/libctf/testsuite/libctf-regression/zrewrite.c b/libctf/testsui= te/libctf-regression/zrewrite.c index a88c824b568..5e061f10a5f 100644 --- a/libctf/testsuite/libctf-regression/zrewrite.c +++ b/libctf/testsuite/libctf-regression/zrewrite.c @@ -109,7 +109,7 @@ main (int argc, char *argv[]) =20 b =3D read_file ("tmpdir/two", &b_len); =20 - if (memcmp (a, b, b_len) =3D=3D 0) + if (a_len =3D=3D b_len && memcmp (a, b, b_len) =3D=3D 0) { fprintf (stderr, "compress_writes after adding types does not change= the dict\n"); return 1;