]> granicus.if.org Git - file/commitdiff
avoid malloc(0) on aix. (Lorinczy Zsigmond)
authorChristos Zoulas <christos@zoulas.com>
Thu, 9 Aug 2012 16:33:15 +0000 (16:33 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 9 Aug 2012 16:33:15 +0000 (16:33 +0000)
src/ascmagic.c

index 5a1caacb5a70921ba6a2879560886044b4d0a65b..000c9de56bbb7ab00bfd030439f203161b059f97 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.84 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.85 2012/08/09 16:33:15 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -134,7 +134,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
                goto done;
        }
 
-       if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
+       if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
                /* Convert ubuf to UTF-8 and try text soft magic */
                /* malloc size is a conservative overestimate; could be
                   improved, or at least realloced after conversion. */