aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-08-21 16:30:00 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2020-08-24 18:04:55 +0100
commit3cdad0846b5f37898798d4145e5b991900a46ec5 (patch)
treef12756bd780d29a64c6d682fcdda42c195695dfb
parent918dc783deadc206691dcc20bf8aa6c807c10244 (diff)
downloadgdb-3cdad0846b5f37898798d4145e5b991900a46ec5.zip
gdb-3cdad0846b5f37898798d4145e5b991900a46ec5.tar.gz
gdb-3cdad0846b5f37898798d4145e5b991900a46ec5.tar.bz2
Fix erroroneous use of '%zu' in elfcore_grok_win32pstatus
As reported in [1], _bfd_error_handler() doesn't support '%zu'. module_name_size is always 32-bits in the data structure we are extracting it from, so use an unsigned int to store it instead. [1] https://sourceware.org/pipermail/gdb-patches/2020-August/171391.html bfd/ChangeLog: 2020-08-21 Jon Turney <jon.turney@dronecode.org.uk> * elf.c (elfcore_grok_win32pstatus): Change name_size to unsigned int. Use '%u' format with _bfd_error_handler to render it.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ca79c4e..f2d1812 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-21 Jon Turney <jon.turney@dronecode.org.uk>
+
+ * elf.c (elfcore_grok_win32pstatus): Change name_size to unsigned
+ int. Use '%u' format with _bfd_error_handler to render it.
+
2020-08-25 Alan Modra <amodra@gmail.com>
PR 26489
diff --git a/bfd/elf.c b/bfd/elf.c
index ecd9217..f32118a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10140,7 +10140,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
char buf[30];
char *name;
size_t len;
- size_t name_size;
+ unsigned int name_size;
asection *sect;
unsigned int type;
int is_active_thread;
@@ -10248,7 +10248,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
if (note->descsz < 12 + name_size)
{
- _bfd_error_handler (_("%pB: win32pstatus NOTE_INFO_MODULE of size %lu is too small to contain a name of size %zu"),
+ _bfd_error_handler (_("%pB: win32pstatus NOTE_INFO_MODULE of size %lu is too small to contain a name of size %u"),
abfd, note->descsz, name_size);
return TRUE;
}