summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-11-27 20:44:14 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2019-11-27 20:50:06 +0100
commit584ffa02f1bef6931b3feb78559841ffe9c8600f (patch)
tree1dc1f13574bed4a07edf01a626a51df8e80fa619
parent3fc1f6260f137790f83865a534cded00a18b3274 (diff)
downloadmariadb-git-584ffa02f1bef6931b3feb78559841ffe9c8600f.tar.gz
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.
-rw-r--r--sql/proxy_protocol.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/proxy_protocol.cc b/sql/proxy_protocol.cc
index b54af619487..550813c6457 100644
--- a/sql/proxy_protocol.cc
+++ b/sql/proxy_protocol.cc
@@ -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.