Skip to content

Commit a6e451d

Browse files
committed
Merge branch '10.3' into 10.4
2 parents ddffcad + a707c7f commit a6e451d

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=10
22
MYSQL_VERSION_MINOR=4
3-
MYSQL_VERSION_PATCH=14
3+
MYSQL_VERSION_PATCH=15
44
SERVER_MATURITY=stable

sql/wsrep_sst.cc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,35 @@ static int sst_donate_other (const char* method,
18221822
return arg.err;
18231823
}
18241824

1825+
/* return true if character can be a part of a filename */
1826+
static bool filename_char(int const c)
1827+
{
1828+
return isalnum(c) || (c == '-') || (c == '_') || (c == '.');
1829+
}
1830+
1831+
/* return true if character can be a part of an address string */
1832+
static bool address_char(int const c)
1833+
{
1834+
return filename_char(c) ||
1835+
(c == ':') || (c == '[') || (c == ']') || (c == '/');
1836+
}
1837+
1838+
static bool check_request_str(const char* const str,
1839+
bool (*check) (int c))
1840+
{
1841+
for (size_t i(0); str[i] != '\0'; ++i)
1842+
{
1843+
if (!check(str[i]))
1844+
{
1845+
WSREP_WARN("Illegal character in state transfer request: %i (%c).",
1846+
str[i], str[i]);
1847+
return true;
1848+
}
1849+
}
1850+
1851+
return false;
1852+
}
1853+
18251854
int wsrep_sst_donate(const std::string& msg,
18261855
const wsrep::gtid& current_gtid,
18271856
const bool bypass)
@@ -1833,8 +1862,21 @@ int wsrep_sst_donate(const std::string& msg,
18331862

18341863
const char* method= msg.data();
18351864
size_t method_len= strlen (method);
1865+
1866+
if (check_request_str(method, filename_char))
1867+
{
1868+
WSREP_ERROR("Bad SST method name. SST canceled.");
1869+
return WSREP_CB_FAILURE;
1870+
}
1871+
18361872
const char* data= method + method_len + 1;
18371873

1874+
if (check_request_str(data, address_char))
1875+
{
1876+
WSREP_ERROR("Bad SST address string. SST canceled.");
1877+
return WSREP_CB_FAILURE;
1878+
}
1879+
18381880
wsp::env env(NULL);
18391881
if (env.error())
18401882
{

0 commit comments

Comments
 (0)