From fe5c37ae95ac64762f307d983000246e3429017f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 2 May 2000 15:32:22 -0300 Subject: BUG: `strfind' gets wrong subject length when there is an offset --- lstrlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lstrlib.c') diff --git a/lstrlib.c b/lstrlib.c index 3a1d8ba3..6a38fd01 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.40 2000/02/08 16:34:31 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.41 2000/03/03 14:58:26 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -405,7 +405,7 @@ static void str_find (lua_State *L) { luaL_arg_check(L, 0 <= init && init <= l1, 3, "out of range"); if (lua_getparam(L, 4) != LUA_NOOBJECT || strpbrk(p, SPECIALS) == NULL) { /* no special characters? */ - const char *s2 = memfind(s+init, l1, p, l2); + const char *s2 = memfind(s+init, l1-init, p, l2); if (s2) { lua_pushnumber(L, s2-s+1); lua_pushnumber(L, s2-s+l2); -- cgit v1.2.3-55-g6feb