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) {
24182418 auto beg = i;
24192419 while (i < path.size () && path[i] != ' /' ) {
24202420 if (path[i] == ' \0 ' ) { return false ; }
2421+ else if (path[i] == ' \\ ' ) { return false ; }
24212422 i++;
24222423 }
24232424
Original file line number Diff line number Diff line change @@ -2509,6 +2509,12 @@ TEST_F(ServerTest, GetMethodOutOfBaseDirMount2) {
25092509 EXPECT_EQ (StatusCode::NotFound_404, res->status );
25102510}
25112511
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+
25122518TEST_F (ServerTest, PostMethod303) {
25132519 auto res = cli_.Post (" /1" , " body" , " text/plain" );
25142520 ASSERT_TRUE (res);
You can’t perform that action at this time.
0 commit comments