50f89d
commit e4e4fde51a309801af5eed72d3494cbf4b7737aa
50f89d
Author: Paul Eggert <eggert@cs.ucla.edu>
50f89d
Date:   Tue Sep 18 15:02:10 2018 -0700
50f89d
50f89d
    Fix tzfile low-memory assertion failure
50f89d
    
50f89d
    [BZ #21716]
50f89d
    * time/tzfile.c (__tzfile_read): Check for memory exhaustion
50f89d
    when registering time zone abbreviations.
50f89d
50f89d
diff --git a/time/tzfile.c b/time/tzfile.c
50f89d
index 2a385b92bcdefec0..ea6e94030392fc75 100644
50f89d
--- a/time/tzfile.c
50f89d
+++ b/time/tzfile.c
50f89d
@@ -410,7 +410,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
50f89d
 
50f89d
   /* First "register" all timezone names.  */
50f89d
   for (i = 0; i < num_types; ++i)
50f89d
-    (void) __tzstring (&zone_names[types[i].idx]);
50f89d
+    if (__tzstring (&zone_names[types[i].idx]) == NULL)
50f89d
+      goto ret_free_transitions;
50f89d
 
50f89d
   /* Find the standard and daylight time offsets used by the rule file.
50f89d
      We choose the offsets in the types of each flavor that are