Skip to content

Commit

Permalink
MDEV-34404 Use safe_str in spider udfs to avoid passing NULL str
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadb-YuchenPei committed Jun 25, 2024
1 parent 8b16994 commit aebd239
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -4580,7 +4580,7 @@ class THD: public THD_count, /* this must be first */
to->length= db.length;
return to->str == NULL; /* True on error */
}
/* Get db name or "". Use for printing current db */
/* Get db name or "". */
const char *get_db()
{ return safe_str(db.str); }

Expand Down
2 changes: 1 addition & 1 deletion storage/spider/spd_copy_tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int spider_udf_set_copy_tables_param_default(
copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd);
if (
!(copy_tables->database = spider_create_string(
SPIDER_THD_db_str(copy_tables->trx->thd),
copy_tables->trx->thd->get_db(),
copy_tables->database_length))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
Expand Down
2 changes: 1 addition & 1 deletion storage/spider/spd_direct_sql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ int spider_udf_set_direct_sql_param_default(
direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd);
if (
!(direct_sql->tgt_default_db_name = spider_create_string(
SPIDER_THD_db_str(trx->thd),
trx->thd->get_db(),
direct_sql->tgt_default_db_name_length))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
Expand Down

0 comments on commit aebd239

Please sign in to comment.