From: Christos Zoulas Date: Thu, 16 Oct 2008 16:30:34 +0000 (+0000) Subject: return NULL rather than core-dumping if no magic output is set. X-Git-Tag: FILE5_05~307 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fc1d8e76539133557265818c717d30bbd0db7b5;p=file return NULL rather than core-dumping if no magic output is set. --- diff --git a/src/funcs.c b/src/funcs.c index a29ec20d..bbe152c1 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -41,7 +41,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.45 2008/10/12 15:38:52 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.46 2008/10/16 16:30:34 christos Exp $") #endif /* lint */ #ifndef SIZE_MAX @@ -266,6 +266,9 @@ file_getbuffer(struct magic_set *ms) if (ms->flags & MAGIC_RAW) return ms->o.buf; + if (ms->o.buf == NULL) + return NULL; + /* * 4 is for octal representation, + 1 is for NUL */ len = strlen(ms->o.buf); if (len > (SIZE_MAX - 1) / 4) {