From: Vsevolod Stakhov Date: Tue, 23 Aug 2016 18:14:12 +0000 (+0100) Subject: [Fix] Fix handling of '\0' in lua_tcp X-Git-Tag: 1.3.5~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6e81653e6d20e84123f76c136f5d76b39cb9820;p=thirdparty%2Frspamd.git [Fix] Fix handling of '\0' in lua_tcp --- diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 094ebf12b5..4c202787ff 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -398,16 +398,18 @@ lua_tcp_arg_toiovec (lua_State *L, gint pos, rspamd_mempool_t *pool, } } else { + msg_err ("bad userdata argument at position %d", pos); return FALSE; } } else if (lua_type (L, pos) == LUA_TSTRING) { str = luaL_checklstring (L, pos, &len); - vec->iov_base = rspamd_mempool_alloc (pool, len + 1); - rspamd_strlcpy (vec->iov_base, str, len + 1); + vec->iov_base = rspamd_mempool_alloc (pool, len); + memcpy (vec->iov_base, str, len); vec->iov_len = len; } else { + msg_err ("bad argument at position %d", pos); return FALSE; }