aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Kulchenko <paul@kulchenko.com>2022-03-18 02:23:09 -0700
committerGitHub <noreply@github.com>2022-03-18 12:23:09 +0300
commitd9cc531e3bc62cfe7965c8cb3df7b1d510f3f4a2 (patch)
treeb8b937bd2d665e69a9bb9df1e83a330ab2bf278e /src
parent5b18e475f38fcf28429b1cc4b17baee3b9793a62 (diff)
downloadluasocket-d9cc531e3bc62cfe7965c8cb3df7b1d510f3f4a2.tar.gz
luasocket-d9cc531e3bc62cfe7965c8cb3df7b1d510f3f4a2.tar.bz2
luasocket-d9cc531e3bc62cfe7965c8cb3df7b1d510f3f4a2.zip
Fixe an issue with aux buffer init overwriting optional parameters in receive() (#334)
Fixes use on Lua >= 5.4.3
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index ac5c531..7148be3 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -103,11 +103,14 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
103* object:receive() interface 103* object:receive() interface
104\*-------------------------------------------------------------------------*/ 104\*-------------------------------------------------------------------------*/
105int buffer_meth_receive(lua_State *L, p_buffer buf) { 105int buffer_meth_receive(lua_State *L, p_buffer buf) {
106 int err = IO_DONE, top = lua_gettop(L); 106 int err = IO_DONE, top;
107 luaL_Buffer b; 107 luaL_Buffer b;
108 size_t size; 108 size_t size;
109 const char *part = luaL_optlstring(L, 3, "", &size); 109 const char *part = luaL_optlstring(L, 3, "", &size);
110 timeout_markstart(buf->tm); 110 timeout_markstart(buf->tm);
111 /* make sure we don't confuse buffer stuff with arguments */
112 lua_settop(L, 3);
113 top = lua_gettop(L);
111 /* initialize buffer with optional extra prefix 114 /* initialize buffer with optional extra prefix
112 * (useful for concatenating previous partial results) */ 115 * (useful for concatenating previous partial results) */
113 luaL_buffinit(L, &b); 116 luaL_buffinit(L, &b);