aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/0006-optencoding-allow-negative-indices.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/lua-ossl/0006-optencoding-allow-negative-indices.patch')
-rw-r--r--main/lua-ossl/0006-optencoding-allow-negative-indices.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/main/lua-ossl/0006-optencoding-allow-negative-indices.patch b/main/lua-ossl/0006-optencoding-allow-negative-indices.patch
new file mode 100644
index 0000000000..836ddd21cc
--- /dev/null
+++ b/main/lua-ossl/0006-optencoding-allow-negative-indices.patch
@@ -0,0 +1,48 @@
+From 49ea990493039729e5a856f8bb3c758a0aa98a78 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Sun, 2 Sep 2018 14:40:07 +0300
+Subject: [PATCH 06/10] optencoding: allow negative indices
+
+---
+ src/openssl.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/src/openssl.c b/src/openssl.c
+index 5904bf1..cb38f2f 100644
+--- a/src/openssl.c
++++ b/src/openssl.c
+@@ -846,8 +846,12 @@ static int optencoding(lua_State *L, int index, const char *def, int allow) {
+ break;
+ }
+
+- if (!(type & allow))
+- luaL_argerror(L, index, lua_pushfstring(L, "invalid option %s", luaL_checkstring(L, index)));
++ if (!(type & allow)) {
++ const char *arg = luaL_checkstring(L, index);
++ if (index > 0)
++ luaL_argerror(L, index, lua_pushfstring(L, "invalid format: %s", arg));
++ luaL_error(L, "invalid format: %s", arg);
++ }
+
+ return type;
+ } /* optencoding() */
+@@ -1186,11 +1190,15 @@ static int auxL_testoption(lua_State *L, int index, const char *def, const char
+
+ static int auxL_checkoption(lua_State *L, int index, const char *def, const char *const *optlist, _Bool nocase) {
+ int i;
++ const char *arg;
+
+ if ((i = auxL_testoption(L, index, def, optlist, nocase)) >= 0)
+ return i;
+
+- return luaL_argerror(L, index, lua_pushfstring(L, "invalid option '%s'", luaL_optstring(L, index, def)));
++ arg = luaL_optstring(L, index, def);
++ if (index > 0)
++ return luaL_argerror(L, index, lua_pushfstring(L, "invalid option '%s'", arg));
++ return luaL_error(L, "invalid option '%s'", arg);
+ } /* auxL_checkoption() */
+
+ /*
+--
+2.24.1
+