commit 4192b13768ca86104ab0e2359a919443fec0a15b
parent cb291cc39432a71be76d6de2a1a730bc3bad2df9
Author: anonymous <p37sitdu@lavabit.com>
Date: Thu, 19 Jan 2012 00:04:04 +0000
ls: allocate proper space for args
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ls.c b/ls.c
@@ -62,7 +62,7 @@ main(int argc, char *argv[])
many = (argc > optind+1);
if((n = argc - optind) > 0) {
- if(!(ents = malloc((argc-1) * sizeof *ents)))
+ if(!(ents = malloc(n * sizeof *ents)))
eprintf("malloc:");
for(i = 0; i < n; i++)
mkent(&ents[i], argv[optind+i]);