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.sbin/quot/quot.c | |
parent | be524287dc216d876f995eddcaf32762c702c6e9 (diff) |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/quot/quot.c')
-rw-r--r-- | usr.sbin/quot/quot.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 3760aa19a82..2bfd2375208 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quot.c,v 1.17 2007/07/04 17:14:45 millert Exp $ */ +/* $OpenBSD: quot.c,v 1.18 2007/09/02 15:19:40 deraadt Exp $ */ /* * Copyright (C) 1991, 1994 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: quot.c,v 1.17 2007/07/04 17:14:45 millert Exp $"; +static char rcsid[] = "$Id: quot.c,v 1.18 2007/09/02 15:19:40 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -437,7 +437,7 @@ douser(int fd, struct fs *super, char *name) else if (errno) err(1, "%s", name); } - if (!(usrs = (struct user *)malloc(nusers * sizeof(struct user)))) + if (!(usrs = (struct user *)calloc(nusers, sizeof(struct user)))) err(1, "allocate users"); memcpy(usrs, users, nusers * sizeof(struct user)); sortusers(usrs); |