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 8639E2EDD4 for ; Wed, 8 May 2019 12:42:17 -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 KEDJaNO7WkmL for ; Wed, 8 May 2019 12:42:17 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 E0DB52EDCA for ; Wed, 8 May 2019 12:42:16 -0400 (EDT) Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1hOPe3-0004dR-4E for tarantool-patches@freelists.org; Wed, 08 May 2019 19:42:15 +0300 From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/1] swim: check broadcast interfaces more rigorously Date: Wed, 8 May 2019 19:42:14 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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)