diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc index a33c1f1cb5d..bc223f1ed3f 100644 --- a/sql/item_inetfunc.cc +++ b/sql/item_inetfunc.cc @@ -628,6 +628,13 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str) { if (rg.pos >= 0) { if (rg.length > gap.length) gap = rg; } + + // RFC 5952, Section 4.2.2: "::" MUST NOT be used to shorten just one + // 16-bit 0 field. + if (gap.length == 1) { + gap.pos = -1; + gap.length = -1; + } } // 3. Convert binary data to string.