[tarantool-patches] Re: [PATCH 1/4] swim: move sockaddr_in checkers to swim_proto.h
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Thu Apr 18 18:24:18 MSK 2019
On 18/04/2019 18:16, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [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
>
More information about the Tarantool-patches
mailing list