Skip to content

Commit

Permalink
MDEV-7222: Cluster Node Crash at CREATE DEFINER statement
Browse files Browse the repository at this point in the history
Check whether the definer host string is not null before
appending it to the specified buffer.
  • Loading branch information
Nirbhay Choubey committed Jan 2, 2015
1 parent 25aaa65 commit 455f77b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mysql-test/suite/galera/r/view.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# MDEV-7222: Cluster Node Crash at CREATE DEFINER statement
#
USE test;
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT 1;
DROP VIEW v1;
# End of tests
11 changes: 11 additions & 0 deletions mysql-test/suite/galera/t/view.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

--echo #
--echo # MDEV-7222: Cluster Node Crash at CREATE DEFINER statement
--echo #
USE test;
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT 1;
DROP VIEW v1;

--echo # End of tests
2 changes: 1 addition & 1 deletion sql/sql_show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
{
buffer->append(STRING_WITH_LEN("DEFINER="));
append_identifier(thd, buffer, definer_user->str, definer_user->length);
if (definer_host->str[0])
if (definer_host->str && definer_host->str[0])
{
buffer->append('@');
append_identifier(thd, buffer, definer_host->str, definer_host->length);
Expand Down

0 comments on commit 455f77b

Please sign in to comment.