summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-10-05 18:05:38 +0200
committerSergei Golubchik <serg@mariadb.org>2020-10-05 18:05:38 +0200
commita707c7f0dd628013bd0857ff7411b3ab6633cfa3 (patch)
tree781454b122ff942bb3c8d16849e38cc287e1da8d
parent4668e079eed635c9ff19a39e584202d3a4e590c1 (diff)
parenta464917766dc513b524d16282b8f2c30f323abe5 (diff)
downloadmariadb-git-a707c7f0dd628013bd0857ff7411b3ab6633cfa3.tar.gz
Merge branch '10.2' into 10.3mariadb-10.3.25
-rw-r--r--VERSION2
-rw-r--r--sql/wsrep_sst.cc51
2 files changed, 47 insertions, 6 deletions
diff --git a/VERSION b/VERSION
index 19a3d95ed2d..5f8bdaf364f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=3
-MYSQL_VERSION_PATCH=24
+MYSQL_VERSION_PATCH=25
SERVER_MATURITY=stable
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 714df35de8b..44fc80c5a69 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1726,24 +1726,65 @@ 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;
+}
+
wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
const void* msg, size_t msg_len,
const wsrep_gtid_t* current_gtid,
const char* state, size_t state_len,
bool bypass)
{
- /* This will be reset when sync callback is called.
- * Should we set wsrep_ready to FALSE here too? */
-
- wsrep_config_state->set(WSREP_MEMBER_DONOR);
-
const char* method = (char*)msg;
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;
+ }
+
char uuid_str[37];
wsrep_uuid_print (&current_gtid->uuid, uuid_str, sizeof(uuid_str));
+ /* This will be reset when sync callback is called.
+ * Should we set wsrep_ready to FALSE here too? */
+ wsrep_config_state->set(WSREP_MEMBER_DONOR);
+
wsp::env env(NULL);
if (env.error())
{