Skip to content

Commit 584ffa0

Browse files
committed
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.
1 parent 3fc1f62 commit 584ffa0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/proxy_protocol.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static int compare_bits(const void *s1, const void *s2, int bit_count)
470470
int byte_count= bit_count / 8;
471471
if (byte_count && (result= memcmp(s1, s2, byte_count)))
472472
return result;
473-
int rem= byte_count % 8;
473+
int rem= bit_count % 8;
474474
if (rem)
475475
{
476476
// compare remaining bits i.e partial bytes.

0 commit comments

Comments
 (0)