* [binutils-gdb] buffer overflow in libctf tests
@ 2024-04-24 1:39 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-04-24 1:39 UTC (permalink / raw)
To: binutils-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=122f6f14b135480b184091bf2037ea133beedc54
commit 122f6f14b135480b184091bf2037ea133beedc54
Author: Alan Modra <amodra@gmail.com>
Date: Wed Apr 24 09:30:24 2024 +0930
buffer overflow in libctf tests
* 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/testsuite/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 = read_gz ("tmpdir/two.gz", &b_len)) == NULL)
goto read_err;
- if (memcmp (a, b, b_len) == 0)
+ if (a_len == b_len && memcmp (a, b, b_len) == 0)
{
fprintf (stderr, "gzwrites after adding types does not change the dict\n");
return 1;
diff --git a/libctf/testsuite/libctf-regression/zrewrite.c b/libctf/testsuite/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[])
b = read_file ("tmpdir/two", &b_len);
- if (memcmp (a, b, b_len) == 0)
+ if (a_len == b_len && memcmp (a, b, b_len) == 0)
{
fprintf (stderr, "compress_writes after adding types does not change the dict\n");
return 1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-24 1:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 1:39 [binutils-gdb] buffer overflow in libctf tests Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).