From f35360c37203a2efe4238a8ec8dd5c45cde0820b Mon Sep 17 00:00:00 2001 From: obrien Date: Fri, 28 Feb 2003 05:19:36 +0000 Subject: Virgin import of Christos Zoulas's FILE 3.41. * - fix memory allocation problem (Jeff Johnson) * - fix stack overflow corruption (David Endler) --- contrib/file/apprentice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/file/apprentice.c') diff --git a/contrib/file/apprentice.c b/contrib/file/apprentice.c index 522945d..575bad6 100644 --- a/contrib/file/apprentice.c +++ b/contrib/file/apprentice.c @@ -38,7 +38,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.49 2002/07/03 19:00:41 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.50 2003/02/27 20:47:46 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -231,7 +231,7 @@ apprentice_file(struct magic **magicp, uint32_t *nmagicp, const char *fn, } maxmagic = MAXMAGIS; - *magicp = (struct magic *) calloc(sizeof(struct magic), maxmagic); + *magicp = (struct magic *) calloc(maxmagic, sizeof(struct magic)); if (*magicp == NULL) { (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, strerror(errno)); -- cgit v1.1