diff options
author | Monty <monty@mariadb.org> | 2017-11-09 23:21:41 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-11-09 23:21:41 +0200 |
commit | 0bb0d52221af99c46d17486382806caa6dd7338e (patch) | |
tree | 92b2ddfceaf8df5be6d47774b25fd3006ac5bb35 /plugin | |
parent | 7dbff2c513aeec3b3f3d0fa4952ae97deba22282 (diff) | |
parent | d40c23570ff1a9ba5aa317b85a32a4b27780b8ab (diff) | |
download | mariadb-git-0bb0d52221af99c46d17486382806caa6dd7338e.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
mysql-test/r/cte_recursive.result
mysql-test/r/derived_cond_pushdown.result
mysql-test/t/cte_recursive.test
mysql-test/t/derived_cond_pushdown.test
sql/datadict.cc
sql/handler.cc
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/server_audit/server_audit.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 87a18e47fc5..b75f6b9a863 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -15,7 +15,7 @@ #define PLUGIN_VERSION 0x104 -#define PLUGIN_STR_VERSION "1.4.2" +#define PLUGIN_STR_VERSION "1.4.3" #define _my_thread_var loc_thread_var @@ -1118,6 +1118,21 @@ do { \ } while(0) +#define ESC_MAP_SIZE 0x60 +static const char esc_map[ESC_MAP_SIZE]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '\'', 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0 +}; + +static char escaped_char(char c) +{ + return ((unsigned char ) c) >= ESC_MAP_SIZE ? 0 : esc_map[(unsigned char) c]; +} static void setup_connection_initdb(struct connection_info *cn, @@ -1324,21 +1339,16 @@ static size_t escape_string(const char *str, unsigned int len, const char *res_end= result + result_len - 2; while (len) { + char esc_c; + if (result >= res_end) break; - if (*str == '\'') - { - if (result+1 >= res_end) - break; - *(result++)= '\\'; - *(result++)= '\''; - } - else if (*str == '\\') + if ((esc_c= escaped_char(*str))) { if (result+1 >= res_end) break; *(result++)= '\\'; - *(result++)= '\\'; + *(result++)= esc_c; } else if (is_space(*str)) *(result++)= ' '; @@ -1427,19 +1437,12 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len, no_password: if (result >= res_end) break; - if (*str == '\'') + if ((b_char= escaped_char(*str))) { if (result+1 >= res_end) break; *(result++)= '\\'; - *(result++)= '\''; - } - else if (*str == '\\') - { - if (result+1 >= res_end) - break; - *(result++)= '\\'; - *(result++)= '\\'; + *(result++)= b_char; } else if (is_space(*str)) *(result++)= ' '; |