diff options
author | Sujatha Sivakumar <sujatha.sivakumar@oracle.com> | 2013-06-24 11:11:55 +0530 |
---|---|---|
committer | Sujatha Sivakumar <sujatha.sivakumar@oracle.com> | 2013-06-24 11:11:55 +0530 |
commit | ce29ca8b766b7ef9f7996fefa9b8fd231b3618d4 (patch) | |
tree | 6903cecda6ac84e4287ab67b6ee2396aa71422f6 /sql/sql_lex.cc | |
parent | 99c7d1f1ae495751c845c6896460a4e4ecc35ae8 (diff) | |
download | mariadb-git-ce29ca8b766b7ef9f7996fefa9b8fd231b3618d4.tar.gz |
Bug#16753869:INCORRECT TRUNCATION OF LONG SET EXPRESSION IN
LOAD DATA CAN CAUSE SQL INJECTION
Problem:
=======
A long SET expression in LOAD DATA is incorrectly truncated
when written to the binary log.
Analysis:
========
LOAD DATA statements are reconstructed once again before
they are written to the binary log. When SET clauses are
specified as part of LOAD DATA statement, these SET clause
user command strings need to be stored as it is inorder to
reconstruct the original user command. At present these
strings are stored as part of SET clause item tree's
top most Item node's name itself which is incorrect. As an
Item::name can be of MAX_ALIAS_NAME (256) size. Hence the
name will get truncated to "255".
Because of this the rewritten LOAD DATA statement will be
terminated incorrectly. When this statment is read back by
the mysqlbinlog tool it reads a starting single quote and
continuos to read till it finds an ending quote. Hence any
statement written post ending quote will be considered as
a new statement.
Fix:
===
As name field has length restriction the string value
should not be stored in Item::name. A new String list is
maintained to store the SET expression values and this list
is read during reconstrution.
sql/sql_lex.cc:
Clear the load data set string list during each query
execution.
sql/sql_lex.h:
Added a new String list to store the load data operation's
SET clause user command strings.
sql/sql_load.cc:
Read the SET clause user command strings from load data
set string list.
sql/sql_yacc.yy:
Store the SET caluse user command string as part of load
data set string list.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 3c9e6955151..bc313ed0486 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -372,6 +372,7 @@ void lex_start(THD *thd) /* 'parent_lex' is used in init_query() so it must be before it. */ lex->select_lex.parent_lex= lex; lex->select_lex.init_query(); + lex->load_set_str_list.empty(); lex->value_list.empty(); lex->update_list.empty(); lex->set_var_list.empty(); |