summaryrefslogtreecommitdiff
path: root/src/lapi.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2006-06-19 12:00:00 +0000
committerrepogen <>2006-06-19 12:00:00 +0000
commit0de9166148af8217fd15c8540755753c0256581b (patch)
tree0d5d72e0a7b6b2c91d43dec1a49e8f76e417e6c7 /src/lapi.c
parente7731a8fb8a317aa5c444ef073bfad82fa5baa54 (diff)
downloadlua-github-5.0.x.tar.gz
Lua 5.0.35.0.35.0.x
Diffstat (limited to 'src/lapi.c')
-rw-r--r--src/lapi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lapi.c b/src/lapi.c
index d5dd9ca4..2ed4c634 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.235 2003/04/07 14:36:08 roberto Exp $
+** $Id: lapi.c,v 1.235a 2003/04/07 14:36:08 roberto 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]);
}