From dcd4c05dfaeac27ea1ae101ccc3f47a9483a0fc5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 30 Nov 1997 10:24:41 +0000 Subject: (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. --- lib/savedir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/savedir.c') diff --git a/lib/savedir.c b/lib/savedir.c index 76634eef4..4c07bffc2 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -87,7 +87,7 @@ savedir (dir, name_size) 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); -- cgit v1.2.3-54-g00ecf