diff options
author | Michael Widenius <monty@askmonty.org> | 2011-02-20 18:51:43 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-02-20 18:51:43 +0200 |
commit | 58bb0769bdf13a9747e900aa2f0955137738ce9d (patch) | |
tree | 1b46ea0f72dce27532f0c87c60ba8a1baa453fa0 /sql/sql_plugin.cc | |
parent | 7e497abcfb3e761ba5a368316192ae930fb58f6b (diff) | |
parent | de3c4428b8c759e85631d8d70b5845c872de5400 (diff) | |
download | mariadb-git-58bb0769bdf13a9747e900aa2f0955137738ce9d.tar.gz |
Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria
Now need to merge with latest xtradb before pushing
sql/ha_partition.cc:
Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
Changed to use opt_stack_trace instead of opt_pstack.
Removed references to pstack
sql/partition_element.h:
Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
Fixed wrong assert
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index ff5a37233c5..3f5d143ecf1 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -223,6 +223,26 @@ extern bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists); #endif /* EMBEDDED_LIBRARY */ +/** + Check if the provided path is valid in the sense that it does cause + a relative reference outside the directory. + + @note Currently, this function only check if there are any + characters in FN_DIRSEP in the string, but it might change in the + future. + + @code + check_valid_path("../foo.so") -> true + check_valid_path("foo.so") -> false + @endcode + */ +bool check_valid_path(const char *path, size_t len) +{ + size_t prefix= my_strcspn(files_charset_info, path, path + len, FN_DIRSEP); + return prefix < len; +} + + /**************************************************************************** Value type thunks, allows the C world to play in the C++ world ****************************************************************************/ @@ -346,13 +366,15 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) struct st_plugin_dl *tmp, plugin_dl; void *sym; DBUG_ENTER("plugin_dl_add"); + DBUG_PRINT("enter", ("dl->str: '%s', dl->length: %d", + dl->str, (int) dl->length)); plugin_dir_len= strlen(opt_plugin_dir); /* Ensure that the dll doesn't have a path. This is done to ensure that only approved libraries from the plugin directory are used (to make this even remotely secure). */ - if (my_strchr(files_charset_info, dl->str, dl->str + dl->length, FN_LIBCHAR) || + if (check_valid_path(dl->str, dl->length) || check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN, system_charset_info, 1) || plugin_dir_len + dl->length + 1 >= FN_REFLEN) |