]> granicus.if.org Git - file/commitdiff
Fix Debian bug #407120 (Bug in relative use of search/regex), which is
authorReuben Thomas <rrt@sc3d.org>
Mon, 11 Feb 2008 23:20:51 +0000 (23:20 +0000)
committerReuben Thomas <rrt@sc3d.org>
Mon, 11 Feb 2008 23:20:51 +0000 (23:20 +0000)
caused by relative offsets not working properly.

src/softmagic.c

index c482f07fa7ed9bddf74449eb8c4ba8d9291f3b4b..324a0a2f618ace47e5ff7b661d8b470f1fe6ba01 100644 (file)
@@ -38,7 +38,7 @@
 
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.107 2008/02/11 22:11:24 rrt Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.108 2008/02/11 23:20:51 rrt Exp $")
 #endif /* lint */
 
 private int match(struct magic_set *, struct magic *, uint32_t,
@@ -187,11 +187,11 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
                                 */
                                cont_level = m->cont_level;
                        }
-                       ms->offset = m->offset;
                        if (m->flag & OFFADD) {
                                ms->offset +=
                                    ms->c.li[cont_level - 1].off;
-                       }
+                       } else
+                               ms->offset = m->offset;
 
 #ifdef ENABLE_CONDITIONALS
                        if (m->cond == COND_ELSE ||