Fix read overflow in libr_magic

This commit is contained in:
pancake 2015-02-17 02:03:15 +01:00
parent beda5fd111
commit d7747ab831

View File

@ -167,7 +167,7 @@ static int match(RMagic *ms, struct r_magic *magic, ut32 nmagic, const ut8 *s, s
if (file_check_mem(ms, ++cont_level) == -1)
return -1;
while (magic[magindex+1].cont_level != 0 && ++magindex < nmagic - 1) {
while (magic[magindex].cont_level != 0 && magic[magindex+1].cont_level != 0 && ++magindex < nmagic - 1) {
m = &magic[magindex];
ms->line = m->lineno; /* for messages */