[PATCH 3/3] socket: prevent recvfrom from returning garbage

Vladimir Davydov vdavydov.dev at gmail.com
Fri Aug 24 16:07:48 MSK 2018


On Fri, Aug 24, 2018 at 05:47:39AM +0300, Alexander Turenko wrote:
> In C recvfrom function sets addrlen parameter to zero when called on TCP
> socket (at least on Linux). The src_addr parameter can contain garbage
> in the case, so we should not dereference it.
> 
> Before this commit socket:recvfrom() can return 'from' table with only
> family field (don't sure why, but addr->sa_family often contain PF_INET
> value in my case) or return nil depending on the garbage at the address.
> Now it always return nil.
> ---
>  src/lua/socket.c | 5 +++++
>  1 file changed, 5 insertions(+)

Could you please add a test case?



More information about the Tarantool-patches mailing list