From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 70F682EE0F for ; Wed, 8 May 2019 12:42:45 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w4O5EFXO16-2 for ; Wed, 8 May 2019 12:42:45 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 317AC2EE0C for ; Wed, 8 May 2019 12:42:45 -0400 (EDT) Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1hOPeV-0002xO-Jf for tarantool-patches@freelists.org; Wed, 08 May 2019 19:42:43 +0300 Subject: [tarantool-patches] Re: [PATCH 1/1] swim: check broadcast interfaces more rigorously From: Vladislav Shpilevoy References: Message-ID: Date: Wed, 8 May 2019 19:42:43 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org 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) > >