summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 802b6dbb8d6..c995b50109f 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2646,10 +2646,15 @@ longlong Item_func_inet_aton::val_int()
}
if (c != '.') // IP number can't end on '.'
{
- switch (dot_count)
- {
- case 1: result<<= 8;
- case 2: result<<= 8;
+ /*
+ Handle short-forms addresses according to standard. Examples:
+ 127 -> 0.0.0.127
+ 127.1 -> 127.0.0.1
+ 127.2.1 -> 127.2.0.1
+ */
+ switch (dot_count) {
+ case 1: result<<= 8; /* Fall through */
+ case 2: result<<= 8; /* Fall through */
}
return (result << 8) + (ulonglong) byte_result;
}