diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-15 10:38:09 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-15 10:38:09 -0300 |
| commit | 38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7 (patch) | |
| tree | e641ef35321e0b81cdd1ab577aeaaa1b40858437 /ldblib.c | |
| parent | bc970005ce2e258e29a5c315ea4e49f76a66586e (diff) | |
| download | lua-38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7.tar.gz lua-38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7.tar.bz2 lua-38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7.zip | |
Bug: cannot allow the call 'debug.getinfo(0, ">")'
A 'what' argument starting with '>' indicates that there is a function
in the C stack, which won't be there if the first argument is not a
function.
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 1 |
1 files changed, 1 insertions, 0 deletions
| @@ -152,6 +152,7 @@ static int db_getinfo (lua_State *L) { | |||
| 152 | lua_State *L1 = getthread(L, &arg); | 152 | lua_State *L1 = getthread(L, &arg); |
| 153 | const char *options = luaL_optstring(L, arg+2, "flnSrtu"); | 153 | const char *options = luaL_optstring(L, arg+2, "flnSrtu"); |
| 154 | checkstack(L, L1, 3); | 154 | checkstack(L, L1, 3); |
| 155 | luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'"); | ||
| 155 | if (lua_isfunction(L, arg + 1)) { /* info about a function? */ | 156 | if (lua_isfunction(L, arg + 1)) { /* info about a function? */ |
| 156 | options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ | 157 | options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ |
| 157 | lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ | 158 | lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ |
