about summary refs log tree commit diff
path: root/time/tzfile.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-09-18 15:02:10 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-09-18 15:09:01 -0700
commite4e4fde51a309801af5eed72d3494cbf4b7737aa (patch)
tree40315a0935e9b7a4bd564eb6a8f2bc3885e5c61e /time/tzfile.c
parentd3a43e49f342c4663af0fff9d95000cfe26867c3 (diff)
downloadglibc-e4e4fde51a309801af5eed72d3494cbf4b7737aa.tar.gz
glibc-e4e4fde51a309801af5eed72d3494cbf4b7737aa.tar.xz
glibc-e4e4fde51a309801af5eed72d3494cbf4b7737aa.zip
Fix tzfile low-memory assertion failure
[BZ #21716]
* time/tzfile.c (__tzfile_read): Check for memory exhaustion
when registering time zone abbreviations.
Diffstat (limited to 'time/tzfile.c')
-rw-r--r--time/tzfile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index 2a385b92bc..ea6e940303 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -410,7 +410,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
 
   /* First "register" all timezone names.  */
   for (i = 0; i < num_types; ++i)
-    (void) __tzstring (&zone_names[types[i].idx]);
+    if (__tzstring (&zone_names[types[i].idx]) == NULL)
+      goto ret_free_transitions;
 
   /* Find the standard and daylight time offsets used by the rule file.
      We choose the offsets in the types of each flavor that are