aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-11-18 17:35:39 +0000
committerNick Clifton <nickc@redhat.com>2014-11-18 17:35:39 +0000
commit0593bd3ace3cb64775f4d9e8039da919c26803cd (patch)
tree98309f0634d9a4eb99bd6ff90a7df7971e6b3009 /binutils
parent8435453b810d8ab0574e509446003d10d04abfd4 (diff)
downloadgdb-0593bd3ace3cb64775f4d9e8039da919c26803cd.zip
gdb-0593bd3ace3cb64775f4d9e8039da919c26803cd.tar.gz
gdb-0593bd3ace3cb64775f4d9e8039da919c26803cd.tar.bz2
Fixes a seg-fault when displaying the time data for a corrupt archive.
PR binutuls/17605 * bucomm.c (print_arelt_descr): Check for ctime returning NULL.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/bucomm.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 88127b0..7aa8ad6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
2014-11-18 Nick Clifton <nickc@redhat.com>
+ PR binutuls/17605
+ * bucomm.c (print_arelt_descr): Check for ctime returning NULL.
+
+2014-11-18 Nick Clifton <nickc@redhat.com>
+
PR binutils/17512
* dwarf.c (get_encoded_value): Warn and return if the encoded
value is more than 64-bits long.
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index b8deff5..6e2f692 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -429,8 +429,12 @@ print_arelt_descr (FILE *file, bfd *abfd, bfd_boolean verbose)
const char *ctime_result = (const char *) ctime (&when);
bfd_size_type size;
- /* POSIX format: skip weekday and seconds from ctime output. */
- sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
+ /* PR binutils/17605: Check for corrupt time values. */
+ if (ctime_result == NULL)
+ sprintf (timebuf, _("<time data corrupt>"));
+ else
+ /* POSIX format: skip weekday and seconds from ctime output. */
+ sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';