From: Christos Zoulas Date: Tue, 5 Sep 2017 20:41:59 +0000 (+0000) Subject: Reset to the end of the buffer if not enough lines were found. Found by X-Git-Tag: FILE5_33~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fbe768a87d3c4d46058e9cd2e190320815d931a;p=file Reset to the end of the buffer if not enough lines were found. Found by clusterfuzz. --- diff --git a/src/softmagic.c b/src/softmagic.c index b9e97537..94d5b827 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.249 2017/06/19 18:30:25 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.250 2017/09/05 20:41:59 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1232,7 +1232,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, b++; } if (lines) - last = RCAST(const char *, s) + bytecnt; + last = end; ms->search.s = buf; ms->search.s_len = last - buf;