]> granicus.if.org Git - php/commitdiff
fix invalid read
authorAntony Dovgal <tony2001@php.net>
Fri, 29 Aug 2008 10:53:07 +0000 (10:53 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 29 Aug 2008 10:53:07 +0000 (10:53 +0000)
weird, the code uses correct order of checks just ten lines below

ext/fileinfo/libmagic/softmagic.c

index 6661fe4240c1198828c76668fd85e002993b1726..dc928658a559cde3664d475e53150b547cea0b3e 100644 (file)
@@ -131,8 +131,8 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 
                if ((m->flag & BINTEST) != mode) {
                        /* Skip sub-tests */
-                       while (magic[magindex + 1].cont_level != 0 && ++magindex < nmagic) {
-                               continue;
+                       while (magindex < nmagic - 1 && magic[magindex + 1].cont_level != 0) {
+                               magindex++;
                        }
                        continue; /* Skip to next top-level test*/
                }