aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-07-06 09:00:29 +0930
committerAlan Modra <amodra@gmail.com>2020-07-06 11:30:06 +0930
commitddb43bab174c50656331e5460b18bd8e8be5f522 (patch)
tree56abcfacedf24c89f7ed9f8728d1f7e5d5d83f34 /binutils/readelf.c
parentc56374d118209b8d9fe4caccf595710dd6198a60 (diff)
downloadgdb-ddb43bab174c50656331e5460b18bd8e8be5f522.zip
gdb-ddb43bab174c50656331e5460b18bd8e8be5f522.tar.gz
gdb-ddb43bab174c50656331e5460b18bd8e8be5f522.tar.bz2
asan: readelf: stack buffer overflow
* readelf.c (print_dynamic_symbol): Don't sprintf to buffer to find string length.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 6057515..41547a2 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12091,9 +12091,9 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
int len_avail = 21;
if (! do_wide && version_string != NULL)
{
- char buffer[256];
+ char buffer[16];
- len_avail -= sprintf (buffer, "@%s", version_string);
+ len_avail -= 1 + strlen (version_string);
if (sym_info == symbol_undefined)
len_avail -= sprintf (buffer," (%d)", vna_other);