From: Christos Zoulas Date: Tue, 7 Feb 2017 23:27:32 +0000 (+0000) Subject: If we exceeded the offset in a search don't break, return 0 (no match) X-Git-Tag: FILE5_30~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b3ee2af9ff57f4afd2f1f3470f3bb1fd4a22ec9;p=file If we exceeded the offset in a search don't break, return 0 (no match) From Christoph Biedl --- diff --git a/src/softmagic.c b/src/softmagic.c index f2ba7dfa..2ea3d7d2 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.241 2016/12/20 13:29:20 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.242 2016/12/20 22:44:32 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1844,7 +1844,7 @@ magiccheck(struct magic_set *ms, struct magic *m) for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) { if (slen + idx >= ms->search.s_len) - break; + return 0; v = file_strncmp(m->value.s, ms->search.s + idx, slen, m->str_flags);