aboutsummaryrefslogtreecommitdiff
path: root/loadlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-02-28 12:58:48 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-02-28 12:58:48 -0300
commitd6143b1d7b44f0cc83202ee473f314a2d56372c0 (patch)
treea993c0fd2eff6b18c61480319143b4f658b4789c /loadlib.c
parentd55bb795faaa3a632aeb92fd29fc12b796ae7968 (diff)
downloadlua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.tar.gz
lua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.tar.bz2
lua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.zip
avoid access to undefined global variables
Diffstat (limited to 'loadlib.c')
-rw-r--r--loadlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/loadlib.c b/loadlib.c
index 1fe4fc38..d4e55255 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.16 2005/01/14 14:17:18 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.17 2005/02/18 12:40:02 roberto Exp roberto $
3** Dynamic library loader for Lua 3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5* 5*
@@ -298,7 +298,8 @@ static int loader_Lua (lua_State *L) {
298 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); 298 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
299 const char *path; 299 const char *path;
300 /* try first `LUA_PATH' for compatibility */ 300 /* try first `LUA_PATH' for compatibility */
301 lua_getglobal(L, "LUA_PATH"); 301 lua_pushstring(L, "LUA_PATH");
302 lua_rawget(L, LUA_GLOBALSINDEX);
302 path = lua_tostring(L, -1); 303 path = lua_tostring(L, -1);
303 if (!path) { 304 if (!path) {
304 lua_pop(L, 1); 305 lua_pop(L, 1);