Fixes a seg-fault when displaying the time data for a corrupt archive.
authorNick Clifton <nickc@redhat.com>
Tue, 18 Nov 2014 17:35:39 +0000 (17:35 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 18 Nov 2014 17:35:39 +0000 (17:35 +0000)
PR binutuls/17605
* bucomm.c (print_arelt_descr): Check for ctime returning NULL.

binutils/ChangeLog
binutils/bucomm.c

index 88127b0c555e97cc71179d7730876ce8a9275539..7aa8ad61b0a92c84619d2f48bc513f01e5c8e602 100644 (file)
@@ -1,3 +1,8 @@
+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
index b8deff50a52592d15b19b8cd81bfbca9c0775e69..6e2f6921a0e9ce23503f070443da86a3a826b3f7 100644 (file)
@@ -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';
This page took 0.024745 seconds and 4 git commands to generate.