summaryrefslogtreecommitdiff
path: root/lib/lua/src/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lua/src/lapi.c')
-rw-r--r--lib/lua/src/lapi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/lua/src/lapi.c b/lib/lua/src/lapi.c
index 038d5bf..7298b87 100644
--- a/lib/lua/src/lapi.c
+++ b/lib/lua/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.4 2004-11-27 21:46:07 pixel Exp $
+** $Id: lapi.c,v 1.5 2007-07-25 16:54:32 pixel Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -879,13 +879,13 @@ static const char *aux_upvalue (lua_State *L, int funcindex, int n,
if (!ttisfunction(fi)) return NULL;
f = clvalue(fi);
if (f->c.isC) {
- if (n > f->c.nupvalues) return NULL;
+ if (!(1 <= n && n <= f->c.nupvalues)) return NULL;
*val = &f->c.upvalue[n-1];
return "";
}
else {
Proto *p = f->l.p;
- if (n > p->sizeupvalues) return NULL;
+ if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
*val = f->l.upvals[n-1]->v;
return getstr(p->upvalues[n-1]);
}