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 05DBA2ADF8 for ; Thu, 18 Apr 2019 11:24:22 -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 qn93b41z7HrU for ; Thu, 18 Apr 2019 11:24:21 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 B14B52AD15 for ; Thu, 18 Apr 2019 11:24:21 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 1/4] swim: move sockaddr_in checkers to swim_proto.h References: <1e3490a96e2daec7906def26f31265d995966204.1555530516.git.v.shpilevoy@tarantool.org> <77eb864c-bb05-4f6d-ec96-b784421b83d8@tarantool.org> <20190418151641.GC13022@chai> From: Vladislav Shpilevoy Message-ID: <5554cf76-e1e1-6bde-1aaf-2ee856752523@tarantool.org> Date: Thu, 18 Apr 2019 18:24:18 +0300 MIME-Version: 1.0 In-Reply-To: <20190418151641.GC13022@chai> 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, Konstantin Osipov On 18/04/2019 18:16, Konstantin Osipov wrote: > * Vladislav Shpilevoy [19/04/18 17:11]: >> Sorry, accidentally broke a test. The fix is >> force pushed: >> >> ====================================================== >> swim_inaddr_is_empty(const struct sockaddr_in *addr) >> { >> - return addr->sin_port == 0 && addr->sin_addr.s_addr == 0; >> + return addr->sin_port == 0 || addr->sin_addr.s_addr == 0; >> } > > This means you haven't paused to explain or test or add a > pre-condition check to the setter function. > Why either of the components can be empty, not both? Shouldn't > you check for such broken addresses when setting them, to not > allow setting them at all? > > The patch is OK to push obviously, just food for thought. It's mainly against malicious and bad-formatter packets. Since the protocol will be public, it can happen that custom drivers will send bad packets. > > -- > Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 > http://tarantool.io - www.twitter.com/kostja_osipov >