Fix softmagic crash in PE bin (reported by @daniel-rome)

This commit is contained in:
pancake 2015-09-21 12:48:35 +02:00
parent 465a0338c3
commit 74ccde1168

View File

@ -1313,9 +1313,10 @@ static int magiccheck(RMagic *ms, struct r_magic *m) {
v = 0;
for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
if ((int)ms->search.offset < 0)
break;
if (slen + idx > ms->search.s_len)
break;
v = file_strncmp (m->value.s, ms->search.s + idx, slen, m->str_flags);
if (v == 0) { /* found match */
ms->search.offset += idx;