Skip to content

Commit 1aa66ec

Browse files
phix33trufae
authored andcommitted
Fix oobread when skipping subtests in softmagic match ##crash
1 parent 3008559 commit 1aa66ec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

libr/magic/softmagic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,8 @@ static int match(RMagic *ms, struct r_magic *magic, ut32 nmagic, const ut32 *min
10691069

10701070
if ((m->flag & BINTEST) != mode) {
10711071
/* Skip sub-tests */
1072-
while (magic[magindex + 1].cont_level != 0 && ++magindex < nmagic - 1) {
1073-
continue;
1072+
while (magindex < nmagic - 1 && magic[magindex + 1].cont_level != 0) {
1073+
magindex++;
10741074
}
10751075
continue; /* Skip to next top-level test*/
10761076
}

0 commit comments

Comments
 (0)