summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-10-07 18:59:23 +0200
committerSergei Golubchik <serg@mariadb.org>2020-10-07 18:59:23 +0200
commit2ff2e8463bf5a0d3170f13f7d0814967d8c1a766 (patch)
tree0fe5e7ec3d65b16563b26a37fed151a0c19d18fa /sql/wsrep_sst.cc
parent0c7f52939c907d8e529ad30be065f99ec3a703b4 (diff)
parent5b8ab1934a10966336e66751bc13fc66923b02f6 (diff)
downloadmariadb-git-2ff2e8463bf5a0d3170f13f7d0814967d8c1a766.tar.gz
Merge tag 'mariadb-10.5.6' into 10.5
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 35fe5198bd9..6a7b16d243e 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1825,6 +1825,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)
@@ -1836,8 +1865,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())
{