diff options
author | unknown <Li-Bing.Song@sun.com> | 2010-03-28 16:37:47 +0800 |
---|---|---|
committer | unknown <Li-Bing.Song@sun.com> | 2010-03-28 16:37:47 +0800 |
commit | 4775601012f81655643667d8635e46de120be7ae (patch) | |
tree | a813ba865f4d9d6b86ee3aa123046c8d65544830 /sql/events.cc | |
parent | 604ab4d274ab036acd1725707b436836e98699a0 (diff) | |
download | mariadb-git-4775601012f81655643667d8635e46de120be7ae.tar.gz |
Bug #50095 Multi statement including CREATE EVENT causes rotten binlog entry
The log event of 'CREATE EVENT' was being binlogged with garbage
at the end of the query if 'CREATE EVENT' is followed by another SQL statement
and they were executed as one command.
for example:
DELIMITER |;
CREATE EVENT e1 ON EVERY DAY DO SELECT 1; SELECT 'a';
DELIMITER ;|
When binlogging 'CREATE EVENT', we always create a new statement with definer
and write it into the log event. The new statement is made from cpp_buf(preprocessed buffer).
which is not a c string(end with '\0'), but it is copied as a c string.
In this patch, cpp_buf is copied with its length.
Diffstat (limited to 'sql/events.cc')
-rw-r--r-- | sql/events.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/events.cc b/sql/events.cc index 4c6dd0f35d1..afae512c61d 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -362,7 +362,9 @@ create_query_string(THD *thd, String *buf) /* Append definer */ append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host)); /* Append the left part of thd->query after "DEFINER" part */ - if (buf->append(thd->lex->stmt_definition_begin)) + if (buf->append(thd->lex->stmt_definition_begin, + thd->lex->stmt_definition_end - + thd->lex->stmt_definition_begin)) return 1; return 0; |