diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
commit | 6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch) | |
tree | bb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.bin/sdiff | |
parent | be524287dc216d876f995eddcaf32762c702c6e9 (diff) |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.bin/sdiff')
-rw-r--r-- | usr.bin/sdiff/sdiff.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c index 9e679d435bc..98d78c2bd5a 100644 --- a/usr.bin/sdiff/sdiff.c +++ b/usr.bin/sdiff/sdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdiff.c,v 1.22 2007/06/28 02:14:41 ray Exp $ */ +/* $OpenBSD: sdiff.c,v 1.23 2007/09/02 15:19:34 deraadt Exp $ */ /* * Written by Raymond Lai <ray@cyth.net>. @@ -172,7 +172,7 @@ main(int argc, char **argv) * waste some memory; however we need an extra space for the * NULL at the end, so it sort of works out. */ - if (!(diffargv = malloc(sizeof(char **) * argc * 2))) + if (!(diffargv = calloc(argc, sizeof(char **) * 2))) err(2, "main"); /* Add first argument, the program name. */ |