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 /lib/libc/net/rcmdsh.c | |
parent | be524287dc216d876f995eddcaf32762c702c6e9 (diff) |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'lib/libc/net/rcmdsh.c')
-rw-r--r-- | lib/libc/net/rcmdsh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c index 34a228d1e95..a472162711b 100644 --- a/lib/libc/net/rcmdsh.c +++ b/lib/libc/net/rcmdsh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcmdsh.c,v 1.11 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: rcmdsh.c,v 1.12 2007/09/02 15:19:17 deraadt Exp $ */ /* * Copyright (c) 2001, MagniComp @@ -151,7 +151,7 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, for (n = 7; (p = strchr(++p, ' ')) != NULL; n++) continue; rshprog = strdup(rshprog); - ap = argv = malloc(sizeof(char *) * n); + ap = argv = calloc(sizeof(char *), n); if (rshprog == NULL || argv == NULL) { perror("rcmdsh"); _exit(255); |