Module Name: src
Committed By: salazar
Date: Thu Sep 8 02:55:50 UTC 2016
Modified Files:
src/external/mit/lua/dist/src: loslib.c
Log Message:
fix bug 2 (for Lua.5.3.3) reported on www.lua.org/bugs.html
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/loslib.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/mit/lua/dist/src/loslib.c
diff -u src/external/mit/lua/dist/src/loslib.c:1.6 src/external/mit/lua/dist/src/loslib.c:1.7
--- src/external/mit/lua/dist/src/loslib.c:1.6 Thu Sep 8 02:21:31 2016
+++ src/external/mit/lua/dist/src/loslib.c Thu Sep 8 02:55:50 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: loslib.c,v 1.6 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: loslib.c,v 1.7 2016/09/08 02:55:50 salazar Exp $ */
/*
** Id: loslib.c,v 1.64 2016/04/18 13:06:55 roberto Exp
@@ -262,8 +262,9 @@ 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) {
- if (*option == '|') /* next block? */
+ 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? */
memcpy(buff, conv, oplen); /* copy valid option to buffer */