diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-23 19:14:12 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-23 20:29:03 +0100 |
commit | 486b7e8a46fa2fe4c41bd9e29d885408e0956fb5 (patch) | |
tree | 4d77921d854ebeecd563427d344f08dd8d956e07 /src/lua | |
parent | 8f3dd41b3dba8d93cd2bb883cd82a6654df4415d (diff) | |
download | rspamd-486b7e8a46fa2fe4c41bd9e29d885408e0956fb5.tar.gz rspamd-486b7e8a46fa2fe4c41bd9e29d885408e0956fb5.zip |
[Fix] Fix handling of '\0' in lua_tcp
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_tcp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 094ebf12b..4c202787f 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; } |