]> granicus.if.org Git - file/commitdiff
PR/48: tianxiaogu: Avoid zerodivide
authorChristos Zoulas <christos@zoulas.com>
Wed, 10 Oct 2018 17:41:10 +0000 (17:41 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 10 Oct 2018 17:41:10 +0000 (17:41 +0000)
src/apprentice.c

index ecb15d3bf6ab09b7bc541db5566649d68d6f4173..2a8d4dce87b4e350af76276fac96d3fbbaf89db4 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.280 2018/10/01 18:45:39 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.281 2018/10/10 17:41:10 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -902,6 +902,8 @@ apprentice_magic_strength(const struct magic *m)
                break;
 
        case FILE_SEARCH:
+               if (m->vallen == 0)
+                       break;
                val += m->vallen * MAX(MULT / m->vallen, 1);
                break;