]> 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 73ed96b18be50e7c44687acd62602a6b3e6ee698..f8eee56bf339edf767ef80bf5c08b825370ac468 100644 (file)
@@ -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) {