From 8f0e4a3034b0594fe3a5a949dd5dc85b6a93392b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 31 Dec 2018 14:35:55 +0200 Subject: [PATCH] MXS-2232: Fix version string prefix check The prefix was always added even when the original version would've been acceptable. For example, a version string of 5.5.40 would get converted to 5.5.5-5.5.40 which is quite confusing for older client applications. --- server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index 54fc54824..b13280491 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -220,10 +220,9 @@ std::string get_version_string(SERVICE* service) } // Older applications don't understand versions other than 5 and cause strange problems - const char prefix[] = "5.5.5-"; - - if (strncmp(rval.c_str(), prefix, sizeof(prefix) - 1) != 0) + if (rval[0] != '5') { + const char prefix[] = "5.5.5-"; rval = prefix + rval; }