Skip to content

Commit a464917

Browse files
committed
Merge branch '10.1' into 10.2
2 parents fbcae42 + f4c85ef commit a464917

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
MYSQL_VERSION_MAJOR=10
22
MYSQL_VERSION_MINOR=2
3-
MYSQL_VERSION_PATCH=33
3+
MYSQL_VERSION_PATCH=34

sql/wsrep_sst.cc

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,24 +1723,65 @@ static int sst_donate_other (const char* method,
17231723
return arg.err;
17241724
}
17251725

1726+
/* return true if character can be a part of a filename */
1727+
static bool filename_char(int const c)
1728+
{
1729+
return isalnum(c) || (c == '-') || (c == '_') || (c == '.');
1730+
}
1731+
1732+
/* return true if character can be a part of an address string */
1733+
static bool address_char(int const c)
1734+
{
1735+
return filename_char(c) ||
1736+
(c == ':') || (c == '[') || (c == ']') || (c == '/');
1737+
}
1738+
1739+
static bool check_request_str(const char* const str,
1740+
bool (*check) (int c))
1741+
{
1742+
for (size_t i(0); str[i] != '\0'; ++i)
1743+
{
1744+
if (!check(str[i]))
1745+
{
1746+
WSREP_WARN("Illegal character in state transfer request: %i (%c).",
1747+
str[i], str[i]);
1748+
return true;
1749+
}
1750+
}
1751+
1752+
return false;
1753+
}
1754+
17261755
wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
17271756
const void* msg, size_t msg_len,
17281757
const wsrep_gtid_t* current_gtid,
17291758
const char* state, size_t state_len,
17301759
bool bypass)
17311760
{
1732-
/* This will be reset when sync callback is called.
1733-
* Should we set wsrep_ready to FALSE here too? */
1734-
1735-
wsrep_config_state->set(WSREP_MEMBER_DONOR);
1736-
17371761
const char* method = (char*)msg;
17381762
size_t method_len = strlen (method);
1763+
1764+
if (check_request_str(method, filename_char))
1765+
{
1766+
WSREP_ERROR("Bad SST method name. SST canceled.");
1767+
return WSREP_CB_FAILURE;
1768+
}
1769+
17391770
const char* data = method + method_len + 1;
17401771

1772+
if (check_request_str(data, address_char))
1773+
{
1774+
WSREP_ERROR("Bad SST address string. SST canceled.");
1775+
return WSREP_CB_FAILURE;
1776+
}
1777+
17411778
char uuid_str[37];
17421779
wsrep_uuid_print (&current_gtid->uuid, uuid_str, sizeof(uuid_str));
17431780

1781+
/* This will be reset when sync callback is called.
1782+
* Should we set wsrep_ready to FALSE here too? */
1783+
wsrep_config_state->set(WSREP_MEMBER_DONOR);
1784+
17441785
wsp::env env(NULL);
17451786
if (env.error())
17461787
{

0 commit comments

Comments
 (0)