mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
fixed issue where absolute unix paths were not sanitized
This commit is contained in:
parent
9f64a7b667
commit
155cf759eb
@ -694,7 +694,15 @@ namespace crow
|
||||
}
|
||||
else if ((c == '/') || (c == '\\'))
|
||||
{
|
||||
checkForSpecialEntries = true;
|
||||
//TODO(EDev): uncomment below once #332 is merged
|
||||
if (/*CROW_UNLIKELY(*/i == 0/*)*/) //Prevent Unix Absolute Paths (Windows Absolute Paths are prevented with `(c == ':')`)
|
||||
{
|
||||
data[i] = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkForSpecialEntries = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2473,6 +2473,7 @@ TEST_CASE("sanitize_filename")
|
||||
CHECK(sanitize_filename("abc/COM9") == "abc/_");
|
||||
CHECK(sanitize_filename("abc/COM") == "abc/COM");
|
||||
CHECK(sanitize_filename("abc/CON") == "abc/_");
|
||||
CHECK(sanitize_filename("/abc/") == "_abc/");
|
||||
}
|
||||
|
||||
TEST_CASE("get_port")
|
||||
|
Loading…
Reference in New Issue
Block a user