diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-10-05 18:18:05 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-10-05 18:18:05 +0200 |
commit | a6e451dc7272c408ace8b3fb4d86c79263f7247e (patch) | |
tree | 2463dd80f5443a85946eb331cea8547f3786505a | |
parent | ddffcad64c9ff3299037eed9df1bc92d51f8d07e (diff) | |
parent | a707c7f0dd628013bd0857ff7411b3ab6633cfa3 (diff) | |
download | mariadb-git-a6e451dc7272c408ace8b3fb4d86c79263f7247e.tar.gz |
Merge branch '10.3' into 10.4mariadb-10.4.15
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 42 |
2 files changed, 43 insertions, 1 deletions
@@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=4 -MYSQL_VERSION_PATCH=14 +MYSQL_VERSION_PATCH=15 SERVER_MATURITY=stable diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index c14cfe814fa..dc9e14ea01b 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1822,6 +1822,35 @@ static int sst_donate_other (const char* method, return arg.err; } +/* return true if character can be a part of a filename */ +static bool filename_char(int const c) +{ + return isalnum(c) || (c == '-') || (c == '_') || (c == '.'); +} + +/* return true if character can be a part of an address string */ +static bool address_char(int const c) +{ + return filename_char(c) || + (c == ':') || (c == '[') || (c == ']') || (c == '/'); +} + +static bool check_request_str(const char* const str, + bool (*check) (int c)) +{ + for (size_t i(0); str[i] != '\0'; ++i) + { + if (!check(str[i])) + { + WSREP_WARN("Illegal character in state transfer request: %i (%c).", + str[i], str[i]); + return true; + } + } + + return false; +} + int wsrep_sst_donate(const std::string& msg, const wsrep::gtid& current_gtid, const bool bypass) @@ -1833,8 +1862,21 @@ int wsrep_sst_donate(const std::string& msg, const char* method= msg.data(); size_t method_len= strlen (method); + + if (check_request_str(method, filename_char)) + { + WSREP_ERROR("Bad SST method name. SST canceled."); + return WSREP_CB_FAILURE; + } + const char* data= method + method_len + 1; + if (check_request_str(data, address_char)) + { + WSREP_ERROR("Bad SST address string. SST canceled."); + return WSREP_CB_FAILURE; + } + wsp::env env(NULL); if (env.error()) { |