From 3ca1d7b07cf7b7c7433e8dabbcbc566c64c6e07f Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Thu, 21 Apr 2016 15:23:31 +0000 Subject: [PATCH] Don't make exceeding magic offsets an error; just fail this magic entry test. Consider truncated files... --- src/softmagic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 5b5f0f96..84e394c3 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.229 2016/03/21 23:04:40 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.230 2016/04/18 15:10:34 christos Exp $") #endif /* lint */ #include "magic.h" @@ -254,7 +254,6 @@ flush: switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) { case -1: - return -1; case 0: goto flush; default: @@ -368,7 +367,6 @@ flush: switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) { case -1: - return -1; case 0: flush = 1; break; @@ -840,8 +838,10 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op) } if ((size_t)o > nbytes) { +#if 0 file_error(ms, 0, "Offset out of range %zu > %zu", (size_t)o, nbytes); +#endif return -1; } *op = o; -- 2.40.0