summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-10-05 18:31:57 +0200
committerSergei Golubchik <serg@mariadb.org>2020-10-05 18:31:57 +0200
commit5b8ab1934a10966336e66751bc13fc66923b02f6 (patch)
tree6a82494aa4e2e6ec4d2465d72ad57a399238a859
parent5b3d3792e28fc7a875c7060f772e42a9cd922f83 (diff)
parenta6e451dc7272c408ace8b3fb4d86c79263f7247e (diff)
downloadmariadb-git-5b8ab1934a10966336e66751bc13fc66923b02f6.tar.gz
Merge branch '10.4' into 10.5mariadb-10.5.6
-rw-r--r--VERSION2
-rw-r--r--sql/wsrep_sst.cc42
2 files changed, 43 insertions, 1 deletions
diff --git a/VERSION b/VERSION
index eb704d39d4a..a380661b267 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=5
+MYSQL_VERSION_PATCH=6
SERVER_MATURITY=stable
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 93b7bc74489..144dbfe2eb1 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1824,6 +1824,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)
@@ -1835,8 +1864,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())
{