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_00~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bcc7077fee5c9bb81007615aa8f4198c86c28ae1;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 73ed96b1..f8eee56b 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -41,7 +41,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.44 2008/07/16 18:00:57 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.45 2008/10/12 15:38:52 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) {