Skip to content

Commit 6aa63b1

Browse files
committed
Add yet another bypass attack that runs into the url DoS issue
1 parent b842691 commit 6aa63b1

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

gix-url/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub(crate) fn url(input: &BStr, protocol_end: usize) -> Result<crate::Url, Error
8989
.skip_while(|b| **b == b'/')
9090
.position(|b| *b == b'/')
9191
.unwrap_or(input.len() - protocol_end);
92-
if bytes_to_path > MAX_LEN {
92+
if bytes_to_path > MAX_LEN || protocol_end > MAX_LEN {
9393
return Err(Error::TooLong {
9494
truncated_url: input[..(protocol_end + "://".len() + MAX_LEN).min(input.len())].into(),
9595
len: input.len(),
119 KB
Binary file not shown.

gix-url/tests/parse/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ mod unknown {
139139

140140
#[test]
141141
fn fuzzed() {
142-
for name in ["very-long", "very-long2"] {
142+
for name in ["very-long", "very-long2", "very-long3"] {
143143
let base = Path::new("tests").join("fixtures").join("fuzzed");
144144
let location = base.join(Path::new(name).with_extension("url"));
145145
let url = std::fs::read(&location).unwrap();

0 commit comments

Comments
 (0)