[PATCH] Core: fix conversion of IPv4-mapped IPv6 addresses
Sergey Kandaurov
pluknet at nginx.com
Wed Mar 27 17:50:15 UTC 2024
> On 21 Mar 2024, at 10:53, Piotr Sikora via nginx-devel <nginx-devel at nginx.org> wrote:
>
> Hi Sergey,
>
>> The "shift" remark doesn't describe a problem in details.
>
> It's not a remark, it's the name of the UndefinedBehaviorSanitizer
> check that caught the issue [1].
>
Thanks for clarification, restored.
>> @@ -507,7 +507,7 @@ ngx_cidr_match(struct sockaddr *sa, ngx_
>>
>> p = inaddr6->s6_addr;
>>
>> - inaddr = p[12] << 24;
>> + inaddr = (in_addr_t) p[12] << 24;
>> inaddr += p[13] << 16;
>> inaddr += p[14] << 8;
>> inaddr += p[15];
>
> While this minimizes the diff and silences the error at hand,
> I find my version more readable.
>
> But you're obviously welcome to commit either version.
>
> [1] https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
>
Pushed with commit log refinements, thanks.
--
Sergey Kandaurov
More information about the nginx-devel
mailing list