Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously
@ 2019-05-08 16:42 Vladislav Shpilevoy
  2019-05-08 16:42 ` [tarantool-patches] " Vladislav Shpilevoy
  0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Shpilevoy @ 2019-05-08 16:42 UTC (permalink / raw)
  To: tarantool-patches

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] swim: check broadcast interfaces more rigorously
  2019-05-08 16:42 [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously Vladislav Shpilevoy
@ 2019-05-08 16:42 ` Vladislav Shpilevoy
  0 siblings, 0 replies; 2+ messages in thread
From: Vladislav Shpilevoy @ 2019-05-08 16:42 UTC (permalink / raw)
  To: tarantool-patches

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)
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-08 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 16:42 [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously Vladislav Shpilevoy
2019-05-08 16:42 ` [tarantool-patches] " Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox