You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix crash in mysql_select_db if db is null
This commit is contained in:
@@ -1779,7 +1779,8 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||||||
{
|
{
|
||||||
int error;
|
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);
|
return(error);
|
||||||
free(mysql->db);
|
free(mysql->db);
|
||||||
mysql->db=strdup(db);
|
mysql->db=strdup(db);
|
||||||
|
Reference in New Issue
Block a user