From: Christos Zoulas Date: Tue, 14 Mar 2006 01:04:31 +0000 (+0000) Subject: use calloc to allocate the magic_entries array since we depend on the X-Git-Tag: FILE5_05~758 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64594db115c8d64f4e0cb539390c7d0d1a9e297b;p=file use calloc to allocate the magic_entries array since we depend on the contents being 0. --- diff --git a/src/apprentice.c b/src/apprentice.c index 4432a569..26d45244 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -45,7 +45,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.87 2006/03/02 22:08:57 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.88 2006/03/14 01:04:31 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -381,7 +381,7 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, } maxmagic = MAXMAGIS; - if ((marray = malloc(maxmagic * sizeof(*marray))) == NULL) { + if ((marray = calloc(maxmagic, sizeof(*marray))) == NULL) { (void)fclose(f); file_oomem(ms); return -1; @@ -509,7 +509,7 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, char *t; private const char *fops = FILE_OPS; uint32_t val; - uint32_t cont_level, cont_count; + uint32_t cont_level; cont_level = 0;