diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:29:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:29:54 -0300 |
commit | 68b08848d4ce0fcdcab8d7d1489cf77a6efd7ae8 (patch) | |
tree | 1cbbfca96a898a5d01db0c6f0a8962c066ee75a7 /lbaselib.c | |
parent | 888f91fa24d7561471acb87ddafc156408dd3617 (diff) | |
download | lua-68b08848d4ce0fcdcab8d7d1489cf77a6efd7ae8.tar.gz lua-68b08848d4ce0fcdcab8d7d1489cf77a6efd7ae8.tar.bz2 lua-68b08848d4ce0fcdcab8d7d1489cf77a6efd7ae8.zip |
`dostring' now is safe to run binary code.
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.22 2001/02/06 13:59:29 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.23 2001/02/09 19:52:24 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -284,9 +284,8 @@ static int luaB_dostring (lua_State *L) { | |||
284 | int oldtop = lua_gettop(L); | 284 | int oldtop = lua_gettop(L); |
285 | size_t l; | 285 | size_t l; |
286 | const char *s = luaL_check_lstr(L, 1, &l); | 286 | const char *s = luaL_check_lstr(L, 1, &l); |
287 | if (*s == '\33') /* binary files start with ESC... */ | 287 | const char *chunkname = luaL_opt_string(L, 2, s); |
288 | lua_error(L, "`dostring' cannot run pre-compiled code"); | 288 | return passresults(L, lua_dobuffer(L, s, l, chunkname), oldtop); |
289 | return passresults(L, lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)), oldtop); | ||
290 | } | 289 | } |
291 | 290 | ||
292 | 291 | ||