internal_memscan: add extra check

develop
lethosor 2017-02-04 14:49:09 -05:00
parent f65a981099
commit a8f4833188
1 changed files with 3 additions and 0 deletions

@ -2557,6 +2557,9 @@ static int internal_memscan(lua_State *L)
for (int i = 0; i <= hcount; i++)
{
uint8_t *p = haystack + i*hstep;
if (p + nsize > haystack + (hcount * hstep)) {
break;
}
if (memcmp(p, needle, nsize) == 0) {
lua_pushinteger(L, i);
lua_pushinteger(L, (lua_Integer)p);