summaryrefslogtreecommitdiffstats
path: root/usr.sbin/quot
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
committerderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
commit1ed98fdf61d9dd29369f246109081408082ce54d (patch)
treead7631e58c83830d1fc51cbadb9a2da53c1abfb7 /usr.sbin/quot
parentOpenCVS server init-support with OpenCVS and GNU cvs clients. (diff)
downloadwireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz
wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/quot')
-rw-r--r--usr.sbin/quot/quot.c6
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);