aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-04-15 14:53:32 +0930
committerAlan Modra <amodra@gmail.com>2020-04-15 17:03:17 +0930
commit89246a0e7919e31f112526c11199ad2496980377 (patch)
treefc789d84f1ba2a96ba6d7b10edd713b74da6cd18 /binutils
parentc98a4545dc7bf2bcaf1de539c4eb84784680eaa4 (diff)
downloadgdb-89246a0e7919e31f112526c11199ad2496980377.zip
gdb-89246a0e7919e31f112526c11199ad2496980377.tar.gz
gdb-89246a0e7919e31f112526c11199ad2496980377.tar.bz2
readelf: increase size of static buffers
Translated strings might be larger than the original. * readelf.c (get_group_flags): Translate text. (get_file_type, get_symbol_binding, get_symbol_type), (get_ppc64_symbol_other, get_symbol_other): Increase size of buffer.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c34
2 files changed, 17 insertions, 23 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 63e9085..e6c9c2e 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
2020-04-15 Alan Modra <amodra@gmail.com>
+ * readelf.c (get_group_flags): Translate text.
+ (get_file_type, get_symbol_binding, get_symbol_type),
+ (get_ppc64_symbol_other, get_symbol_other): Increase size of buffer.
+
+2020-04-15 Alan Modra <amodra@gmail.com>
+
PR 25821
* readelf.c (get_num_dynamic_syms): Typo fix.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index efcd6f3..fb6f801 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -2291,7 +2291,7 @@ get_dynamic_type (Filedata * filedata, unsigned long type)
static char *
get_file_type (unsigned e_type)
{
- static char buff[32];
+ static char buff[64];
switch (e_type)
{
@@ -6832,25 +6832,13 @@ get_group_flags (unsigned int flags)
else if (flags == GRP_COMDAT)
return "COMDAT ";
- snprintf (buff, 14, _("[0x%x: "), flags);
+ snprintf (buff, sizeof buff, "[0x%x: %s%s%s]",
+ flags,
+ flags & GRP_MASKOS ? _("<OS specific>") : "",
+ flags & GRP_MASKPROC ? _("<PROC specific>") : "",
+ (flags & ~(GRP_COMDAT | GRP_MASKOS | GRP_MASKPROC)
+ ? _("<unknown>") : ""));
- flags &= ~ GRP_COMDAT;
- if (flags & GRP_MASKOS)
- {
- strcat (buff, "<OS specific>");
- flags &= ~ GRP_MASKOS;
- }
-
- if (flags & GRP_MASKPROC)
- {
- strcat (buff, "<PROC specific>");
- flags &= ~ GRP_MASKPROC;
- }
-
- if (flags)
- strcat (buff, "<unknown>");
-
- strcat (buff, "]");
return buff;
}
@@ -11467,7 +11455,7 @@ process_version_sections (Filedata * filedata)
static const char *
get_symbol_binding (Filedata * filedata, unsigned int binding)
{
- static char buff[32];
+ static char buff[64];
switch (binding)
{
@@ -11494,7 +11482,7 @@ get_symbol_binding (Filedata * filedata, unsigned int binding)
static const char *
get_symbol_type (Filedata * filedata, unsigned int type)
{
- static char buff[32];
+ static char buff[64];
switch (type)
{
@@ -11691,7 +11679,7 @@ get_ppc64_symbol_other (unsigned int other)
other >>= STO_PPC64_LOCAL_BIT;
if (other <= 6)
{
- static char buf[32];
+ static char buf[64];
if (other >= 2)
other = ppc64_decode_local_entry (other);
snprintf (buf, sizeof buf, _("<localentry>: %d"), other);
@@ -11704,7 +11692,7 @@ static const char *
get_symbol_other (Filedata * filedata, unsigned int other)
{
const char * result = NULL;
- static char buff [32];
+ static char buff [64];
if (other == 0)
return "";