]> granicus.if.org Git - file/commitdiff
return NULL rather than core-dumping if no magic output is set.
authorChristos Zoulas <christos@zoulas.com>
Thu, 16 Oct 2008 16:30:34 +0000 (16:30 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 16 Oct 2008 16:30:34 +0000 (16:30 +0000)
src/funcs.c

index a29ec20dd54d63363b84556eb4a7efd2d071bf4f..bbe152c1921c828052795d46ac769034494e0980 100644 (file)
@@ -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) {