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