]> 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 18fa9356ec1a55c4a367b8ccd955812f86d61894..325678da0011f1afc24e5927b70338e32a06f81d 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.83 2011/12/08 12:12:46 rrt Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.84 2011/12/08 12:38:24 rrt 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. */