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