Commit 584ffa02 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-19669 - fix matching CIDR address for proxy protocol.

Prior to this fix, when matching addresses using mask,
extra bits could be used for  comparison, e.g to
match with "a.b.c.d/24" , 27 bits were compared rather than 24.

The patch fixes the calculation.
parent 3fc1f626
......@@ -470,7 +470,7 @@ static int compare_bits(const void *s1, const void *s2, int bit_count)
int byte_count= bit_count / 8;
if (byte_count && (result= memcmp(s1, s2, byte_count)))
return result;
int rem= byte_count % 8;
int rem= bit_count % 8;
if (rem)
{
// compare remaining bits i.e partial bytes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment