1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fix crash in mysql_select_db if db is null

This commit is contained in:
Georg Richter
2018-06-13 17:28:50 +02:00
parent 32246542a3
commit 5b01cd608a

View File

@@ -1779,7 +1779,8 @@ mysql_select_db(MYSQL *mysql, const char *db)
{
int error;
if ((error=ma_simple_command(mysql, COM_INIT_DB,db,(uint) strlen(db),0,0)))
if ((error=ma_simple_command(mysql, COM_INIT_DB, db,
db ? (uint) strlen(db) : 0,0,0)))
return(error);
free(mysql->db);
mysql->db=strdup(db);