File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2418,6 +2418,7 @@ inline bool is_valid_path(const std::string &path) {
2418
2418
auto beg = i;
2419
2419
while (i < path.size () && path[i] != ' /' ) {
2420
2420
if (path[i] == ' \0 ' ) { return false ; }
2421
+ else if (path[i] == ' \\ ' ) { return false ; }
2421
2422
i++;
2422
2423
}
2423
2424
Original file line number Diff line number Diff line change @@ -2509,6 +2509,12 @@ TEST_F(ServerTest, GetMethodOutOfBaseDirMount2) {
2509
2509
EXPECT_EQ (StatusCode::NotFound_404, res->status );
2510
2510
}
2511
2511
2512
+ TEST_F (ServerTest, GetMethodOutOfBaseDirMountWithBackslash) {
2513
+ auto res = cli_.Get (" /mount/%2e%2e%5c/www2/dir/test.html" );
2514
+ ASSERT_TRUE (res);
2515
+ EXPECT_EQ (StatusCode::NotFound_404, res->status );
2516
+ }
2517
+
2512
2518
TEST_F (ServerTest, PostMethod303) {
2513
2519
auto res = cli_.Post (" /1" , " body" , " text/plain" );
2514
2520
ASSERT_TRUE (res);
You can’t perform that action at this time.
0 commit comments