[tarantool-patches] Re: [PATCH 1/1] swim: check broadcast interfaces more rigorously

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed May 8 19:42:43 MSK 2019


Pushed to the master as trivial.

On 08/05/2019 19:42, Vladislav Shpilevoy wrote:
> Appeared, that getifaddrs() standard function can return
> addresses having IFF_BROADCAST flag, but at the same time not
> having struct sockaddr *ifa_broadaddr pointer (NULL).
> 
> It led to a crash. The patch does additional check if the address
> is NULL.
> ---
>  src/lib/swim/swim_io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/swim/swim_io.c b/src/lib/swim/swim_io.c
> index 107f47140..9558d0bb8 100644
> --- a/src/lib/swim/swim_io.c
> +++ b/src/lib/swim/swim_io.c
> @@ -198,7 +198,7 @@ swim_bcast_task_next_addr(struct swim_bcast_task *task)
>  		if ((flags & IFF_UP) == 0)
>  			continue;
>  
> -		if ((flags & IFF_BROADCAST) != 0 &&
> +		if ((flags & IFF_BROADCAST) != 0 && i->ifa_broadaddr != NULL &&
>  		    i->ifa_broadaddr->sa_family == AF_INET) {
>  			task->base.dst =
>  				*(struct sockaddr_in *) i->ifa_broadaddr;
> -- 
> 2.20.1 (Apple Git-117)
> 
> 




More information about the Tarantool-patches mailing list