Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously
Date: Wed,  8 May 2019 19:42:14 +0300	[thread overview]
Message-ID: <e66ab61fc81cba9450b37865706ecb8a7e0cac7e.1557333709.git.v.shpilevoy@tarantool.org> (raw)

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)

             reply	other threads:[~2019-05-08 16:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 16:42 Vladislav Shpilevoy [this message]
2019-05-08 16:42 ` [tarantool-patches] " Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e66ab61fc81cba9450b37865706ecb8a7e0cac7e.1557333709.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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