aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-07-06 09:00:29 +0930
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-01-23 20:23:58 +0200
commitc164d65759a007cbcf54450971f71dd4913062ff (patch)
treeb1be7874f94f121446552d7c3bf6972b996ba04f
parentgas, arm: PR26858 Fix availability of single precision vmul/vmla in arm mode (diff)
downloadbinutils-gdb-c164d65759a007cbcf54450971f71dd4913062ff.tar.gz
binutils-gdb-c164d65759a007cbcf54450971f71dd4913062ff.tar.bz2
binutils-gdb-c164d65759a007cbcf54450971f71dd4913062ff.zip
asan: readelf: stack buffer overflow
PR 26929 * readelf.c (print_dynamic_symbol): Don't sprintf to buffer to find string length. (cherry picked from commit ddb43bab174c50656331e5460b18bd8e8be5f522) (cherry picked from commit 372dd157272e0674d13372655cc60eaca9c06926)
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/readelf.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index a77c7a6527..9dc7136863 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-22 Alan Modra <amodra@gmail.com>
+
+ PR 26929
+ Apply from mainline
+ 2020-07-06 Alan Modra <amodra@gmail.com>
+ * readelf.c (print_dynamic_symbol): Don't sprintf to buffer to
+ find string length.
+
2020-11-16 Mark Wielaard <mark@klomp.org>
Backport from the mainline:
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 6057515a89..41547a2594 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);