summaryrefslogtreecommitdiff
path: root/lib/savedir.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-11-30 10:24:41 +0000
committerJim Meyering <jim@meyering.net>1997-11-30 10:24:41 +0000
commitdcd4c05dfaeac27ea1ae101ccc3f47a9483a0fc5 (patch)
tree549cd9c5102e2b27ab252bef8947516339e1a8ea /lib/savedir.c
parent07783bcdf0fd2f0dc5b4e2707db58e0a62b7e1b6 (diff)
downloadcoreutils-dcd4c05dfaeac27ea1ae101ccc3f47a9483a0fc5.tar.xz
(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.
Diffstat (limited to 'lib/savedir.c')
-rw-r--r--lib/savedir.c2
1 files changed, 1 insertions, 1 deletions
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);