]> granicus.if.org Git - file/commitdiff
handle negative indirect offsets
authorChristos Zoulas <christos@zoulas.com>
Fri, 3 Nov 2017 23:38:09 +0000 (23:38 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 3 Nov 2017 23:38:09 +0000 (23:38 +0000)
src/apprentice.c

index 7af85c8ce42cf84db3528c054ae652d6f5b4ccc2..45bba7253cc9b4435c607980f3e362c9a3c44f1b 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.266 2017/11/03 00:18:55 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.267 2017/11/03 23:38:09 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -1916,9 +1916,11 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
                        file_magwarn(ms, "offset `%s' invalid", l);
                return -1;
        }
-        if (m->offset < 0 && cont_level != 0) {
+        if (m->offset < 0 && cont_level != 0 &&
+           (m->flag & (OFFADD | INDIROFFADD)) == 0) {
                if (ms->flags & MAGIC_CHECK) {
-                       file_magwarn(ms, "negative offset `%s' at level %u",
+                       file_magwarn(ms,
+                           "negative direct offset `%s' at level %u",
                            l, cont_level);
                }
                return -1;