diff options
author | sfan5 <sfan5@live.de> | 2018-05-30 16:30:44 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-05-30 16:30:44 +0200 |
commit | ddd03c38a418c9f2ed204bf4fa68fd1d5feac11f (patch) | |
tree | 37b5d8f02fe8f1de111a9d67b4c128edc9d656c5 /lib/lua/src/lstrlib.c | |
parent | e3e98f935687ba60512889a5ddc62010216aa331 (diff) | |
download | minetest-ddd03c38a418c9f2ed204bf4fa68fd1d5feac11f.tar.xz |
Update embedded Lua to 5.1.5 (#7387)
Diffstat (limited to 'lib/lua/src/lstrlib.c')
-rw-r--r-- | lib/lua/src/lstrlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/lua/src/lstrlib.c b/lib/lua/src/lstrlib.c index 1b4763d4e..7a03489be 100644 --- a/lib/lua/src/lstrlib.c +++ b/lib/lua/src/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -754,6 +754,7 @@ static void addintlen (char *form) { static int str_format (lua_State *L) { + int top = lua_gettop(L); int arg = 1; size_t sfl; const char *strfrmt = luaL_checklstring(L, arg, &sfl); @@ -768,7 +769,8 @@ static int str_format (lua_State *L) { else { /* format item */ char form[MAX_FORMAT]; /* to store the format (`%...') */ char buff[MAX_ITEM]; /* to store the formatted item */ - arg++; + if (++arg > top) + luaL_argerror(L, arg, "no value"); strfrmt = scanformat(L, strfrmt, form); switch (*strfrmt++) { case 'c': { |