about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/loadarchive.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 70136dcf95..f723780ce1 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -274,6 +274,10 @@ _nl_load_locale_from_archive (int category, const char **namep)
   namehashtab = (struct namehashent *) ((char *) head
 					+ head->namehash_offset);
 
+  /* Avoid division by 0 if the file is corrupted.  */
+  if (__glibc_unlikely (head->namehash_size == 0))
+    goto close_and_out;
+
   idx = hval % head->namehash_size;
   incr = 1 + hval % (head->namehash_size - 2);