diff --git a/bugs b/bugs index 58a17b97..b73c691e 100644 --- a/bugs +++ b/bugs @@ -170,3 +170,8 @@ in the following platforms: * IRIX - cc, cc-purify * Windows - Visual C++ (.c e .cpp, warning level=4) + +** lstrlib.c +Tue May 2 15:27:58 EST 2000 +>> `strfind' gets wrong subject length when there is an offset +(by Jon Kleiser; since 4.0a) 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);