Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/mit/lua/dist/src fix bug 2 (for Lua.5.3.3) reported...



details:   https://anonhg.NetBSD.org/src/rev/7383e251c543
branches:  trunk
changeset: 817780:7383e251c543
user:      salazar <salazar%NetBSD.org@localhost>
date:      Thu Sep 08 02:55:50 2016 +0000

description:
fix bug 2 (for Lua.5.3.3) reported on www.lua.org/bugs.html

diffstat:

 external/mit/lua/dist/src/loslib.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (21 lines):

diff -r 0af126e6cf2a -r 7383e251c543 external/mit/lua/dist/src/loslib.c
--- a/external/mit/lua/dist/src/loslib.c        Thu Sep 08 02:53:39 2016 +0000
+++ b/external/mit/lua/dist/src/loslib.c        Thu Sep 08 02:55:50 2016 +0000
@@ -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 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 */



Home | Main Index | Thread Index | Old Index