PR/372: Fix incorrect change made for PR/342: We should not increment
authorChristos Zoulas <christos@zoulas.com>
Sat, 30 Aug 2014 15:30:11 +0000 (15:30 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 30 Aug 2014 15:30:11 +0000 (15:30 +0000)
magindex, if it is not a continuation.

src/softmagic.c

index 6d694192121d0651a46eb737926457a3b014fcab..746f2734732233521fece86ec4bfe5cbd3d4b1bd 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.190 2014/06/03 19:01:34 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.191 2014/06/04 17:36:34 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -235,9 +235,9 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
                if (file_check_mem(ms, ++cont_level) == -1)
                        return -1;
 
-               while (++magindex < nmagic &&
-                   magic[magindex].cont_level != 0) {
-                       m = &magic[magindex];
+               while (magindex + 1 < nmagic &&
+                   magic[magindex + 1].cont_level != 0) {
+                       m = &magic[++magindex];
                        ms->line = m->lineno; /* for messages */
 
                        if (cont_level < m->cont_level)