From: Christos Zoulas Date: Fri, 20 Oct 2006 21:04:15 +0000 (+0000) Subject: initialize the buffers. X-Git-Tag: FILE4_18~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=979f8b9e46b0dfef5b64449f0767b9411d39d7ee;p=file initialize the buffers. --- diff --git a/src/ascmagic.c b/src/ascmagic.c index 43d467cd..81525c89 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -49,7 +49,7 @@ #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.45 2006/03/12 22:09:33 christos Exp $") +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.46 2006/10/20 21:04:15 christos Exp $") #endif /* lint */ typedef unsigned long unichar; @@ -102,9 +102,9 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes) while (nbytes > 1 && buf[nbytes - 1] == '\0') nbytes--; - if ((nbuf = malloc((nbytes + 1) * sizeof(nbuf[0]))) == NULL) + if ((nbuf = calloc(1, (nbytes + 1) * sizeof(nbuf[0]))) == NULL) goto done; - if ((ubuf = malloc((nbytes + 1) * sizeof(ubuf[0]))) == NULL) + if ((ubuf = calloc(1, (nbytes + 1) * sizeof(ubuf[0]))) == NULL) goto done; /*