From 0593bd3ace3cb64775f4d9e8039da919c26803cd Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 18 Nov 2014 17:35:39 +0000 Subject: [PATCH] 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. --- binutils/ChangeLog | 5 +++++ binutils/bucomm.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 88127b0c555..7aa8ad61b0a 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2014-11-18 Nick Clifton + + PR binutuls/17605 + * bucomm.c (print_arelt_descr): Check for ctime returning NULL. + 2014-11-18 Nick Clifton PR binutils/17512 diff --git a/binutils/bucomm.c b/binutils/bucomm.c index b8deff50a52..6e2f6921a0e 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, _("