From 5d9b8b7cdc64777dd1ae071b52c1816fb1faa5e7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 14 Feb 2001 15:04:11 -0200 Subject: more secure definition for lua_concat --- lauxlib.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index 8920ac9c..d36424d2 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.45 2001/01/25 16:45:36 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.46 2001/02/02 19:02:40 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -166,10 +166,8 @@ static void adjuststack (luaL_Buffer *B) { } else break; } while (toget < B->level); - if (toget >= 2) { - lua_concat(L, toget); - B->level = B->level - toget + 1; - } + lua_concat(L, toget); + B->level = B->level - toget + 1; } } @@ -194,10 +192,7 @@ LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { LUALIB_API void luaL_pushresult (luaL_Buffer *B) { emptybuffer(B); - if (B->level == 0) - lua_pushlstring(B->L, NULL, 0); - else if (B->level > 1) - lua_concat(B->L, B->level); + lua_concat(B->L, B->level); B->level = 1; } -- cgit v1.2.3-55-g6feb