changeset 1139:8bc45753f955

(savedir): Check for size zero before invoking malloc; this can occur if st_size arg overflows on conversion to unsigned int. All callers now cast st_size arg to unsigned int.
author Jim Meyering <jim@meyering.net>
date Sun, 30 Nov 1997 10:24:41 +0000
parents 22a1ad770d56
children c20243451df1
files lib/savedir.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/savedir.c
+++ b/lib/savedir.c
@@ -87,7 +87,7 @@
   if (dirp == NULL)
     return NULL;
 
-  name_space = (char *) malloc (name_size);
+  name_space = (char *) malloc (name_size ? name_size : 1);
   if (name_space == NULL)
     {
       closedir (dirp);