summaryrefslogtreecommitdiff
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
commit6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch)
treebb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.bin/locate
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.bin/locate')
-rw-r--r--usr.bin/locate/locate/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index eb96c175404..be8809da98e 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.9 2003/11/08 19:17:29 jmc Exp $
+/* $OpenBSD: util.c,v 1.10 2007/09/02 15:19:33 deraadt Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: util.c,v 1.9 2003/11/08 19:17:29 jmc Exp $
+ * $Id: util.c,v 1.10 2007/09/02 15:19:33 deraadt Exp $
*/
@@ -115,7 +115,7 @@ colon(dbv, path, dot)
else {
/* a string */
slen = ch - c;
- if ((p = malloc(sizeof(char) * (slen + 1)))
+ if ((p = calloc(sizeof(char), slen + 1))
== NULL)
err(1, "malloc");
bcopy(c, p, slen);