diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-14 15:04:11 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-14 15:04:11 -0200 |
commit | 5d9b8b7cdc64777dd1ae071b52c1816fb1faa5e7 (patch) | |
tree | 5b35aecdfb285953765e9b2783f7518f22101eda /lauxlib.c | |
parent | 1c2501fad4de5a06407500587751d71f7331a872 (diff) | |
download | lua-5d9b8b7cdc64777dd1ae071b52c1816fb1faa5e7.tar.gz lua-5d9b8b7cdc64777dd1ae071b52c1816fb1faa5e7.tar.bz2 lua-5d9b8b7cdc64777dd1ae071b52c1816fb1faa5e7.zip |
more secure definition for lua_concat
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.45 2001/01/25 16:45:36 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.46 2001/02/02 19:02:40 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -166,10 +166,8 @@ static void adjuststack (luaL_Buffer *B) { | |||
166 | } | 166 | } |
167 | else break; | 167 | else break; |
168 | } while (toget < B->level); | 168 | } while (toget < B->level); |
169 | if (toget >= 2) { | 169 | lua_concat(L, toget); |
170 | lua_concat(L, toget); | 170 | B->level = B->level - toget + 1; |
171 | B->level = B->level - toget + 1; | ||
172 | } | ||
173 | } | 171 | } |
174 | } | 172 | } |
175 | 173 | ||
@@ -194,10 +192,7 @@ LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { | |||
194 | 192 | ||
195 | LUALIB_API void luaL_pushresult (luaL_Buffer *B) { | 193 | LUALIB_API void luaL_pushresult (luaL_Buffer *B) { |
196 | emptybuffer(B); | 194 | emptybuffer(B); |
197 | if (B->level == 0) | 195 | lua_concat(B->L, B->level); |
198 | lua_pushlstring(B->L, NULL, 0); | ||
199 | else if (B->level > 1) | ||
200 | lua_concat(B->L, B->level); | ||
201 | B->level = 1; | 196 | B->level = 1; |
202 | } | 197 | } |
203 | 198 | ||