summaryrefslogtreecommitdiffstats
path: root/lua-5.3.3-upstream-bug-2.patch
blob: 96cf85a1b5ab78a99cc17a8511d9a562543e5ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
diff -up lua-5.3.3/src/loslib.c.readpast lua-5.3.3/src/loslib.c
--- lua-5.3.3/src/loslib.c.readpast	2016-07-25 16:04:13.916465061 -0400
+++ lua-5.3.3/src/loslib.c	2016-07-25 16:04:19.756423878 -0400
@@ -260,7 +260,8 @@ static int getfield (lua_State *L, const
 static const char *checkoption (lua_State *L, const char *conv, char *buff) {
   const char *option;
   int oplen = 1;
-  for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) {
+  int convlen = (int)strlen(conv);
+  for (option = LUA_STRFTIMEOPTIONS; *option != '\0' && oplen <= convlen; option += oplen) {
     if (*option == '|')  /* next block? */
       oplen++;  /* next length */
     else if (memcmp(conv, option, oplen) == 0) {  /* match? */