aboutsummaryrefslogtreecommitdiff
path: root/lstrlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-11 12:03:07 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-11 12:03:07 -0200
commit57e91b4159082b8cbda54e38c80117a954af154a (patch)
tree97170c86654deb8962983cafda672de984e383d0 /lstrlib.c
parentef7d29c66601ac2484ce474fde9b058b3dd4eaa0 (diff)
downloadlua-57e91b4159082b8cbda54e38c80117a954af154a.tar.gz
lua-57e91b4159082b8cbda54e38c80117a954af154a.tar.bz2
lua-57e91b4159082b8cbda54e38c80117a954af154a.zip
correct computation for limit in 'getnum'
Diffstat (limited to 'lstrlib.c')
-rw-r--r--lstrlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 786016b4..7eb62f37 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.219 2014/12/10 11:36:03 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.220 2014/12/11 13:40:40 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1034,8 +1034,8 @@ static int getnum (const char **fmt, int df) {
1034 else { 1034 else {
1035 int a = 0; 1035 int a = 0;
1036 do { 1036 do {
1037 a = a*10 + *((*fmt)++) - '0'; 1037 a = a*10 + (*((*fmt)++) - '0');
1038 } while (digit(**fmt) && a < ((int)MAXSIZE/10 - 10)); 1038 } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10);
1039 return a; 1039 return a;
1040 } 1040 }
1041} 1041}