From a7dd84a94c8543ffa2dc044099cbcb731fca30d4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 1 Mar 2015 01:36:04 -0500 Subject: improve ALPN validation --- src/openssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/openssl.c b/src/openssl.c index ab19410..f9ff4d5 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -4537,7 +4537,7 @@ static int sx_setAlpnProtos(lua_State *L) { return luaL_argerror(L, 2, "array of strings expected"); } tmp = luaL_checklstring(L, -1, &len); - luaL_argcheck(L, len <= UCHAR_MAX, 2, "proto string too long"); + luaL_argcheck(L, len > 0 && len <= UCHAR_MAX, 2, "proto string length invalid"); luaL_addchar(&B, (unsigned char)len); luaL_addlstring(&B, tmp, len); lua_pop(L, 1); -- cgit v1.2.3-59-g8ed1b