Strip MariaDB 10 prefix

Closes GH-7972
This commit is contained in:
Kamil Tekiela 2022-01-19 17:14:08 +00:00
parent 03816fba46
commit 5fc0db989e
No known key found for this signature in database
GPG key ID: 0760BDAB1E89A1E3
4 changed files with 30 additions and 8 deletions

View file

@ -41,6 +41,8 @@ const char mysqlnd_read_body_name[] = "mysqlnd_read_body";
#define ERROR_MARKER 0xFF
#define EODATA_MARKER 0xFE
#define MARIADB_RPL_VERSION_HACK "5.5.5-"
/* {{{ mysqlnd_command_to_text */
const char * const mysqlnd_command_to_text[COM_END] =
{
@ -369,6 +371,11 @@ php_mysqlnd_greet_read(MYSQLND_CONN_DATA * conn, void * _packet)
DBG_RETURN(PASS);
}
/* MariaDB always sends 5.5.5 before version string: 5.5.5 was never released,
so just ignore it */
if (!strncmp((char *) p, MARIADB_RPL_VERSION_HACK, sizeof(MARIADB_RPL_VERSION_HACK) - 1))
p+= sizeof(MARIADB_RPL_VERSION_HACK) - 1;
packet->server_version = estrdup((char *)p);
p+= strlen(packet->server_version) + 1; /* eat the '\0' */
BAIL_IF_NO_MORE_DATA;