Skip to content

Commit

Permalink
fs: sanitize colons from file requests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Sep 27, 2022
1 parent 3cf1783 commit 0074a0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/filters/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ fn sanitize_path(base: impl AsRef<Path>, tail: &str) -> Result<PathBuf, Rejectio
tracing::warn!("dir: rejecting segment starting with '..'");
return Err(reject::not_found());
} else if seg.contains('\\') {
tracing::warn!("dir: rejecting segment containing with backslash (\\)");
tracing::warn!("dir: rejecting segment containing backslash (\\)");
return Err(reject::not_found());
} else if cfg!(windows) && seg.contains(':') {
tracing::warn!("dir: rejecting segment containing colon (:)");
return Err(reject::not_found());
} else {
buf.push(seg);
Expand Down

0 comments on commit 0074a0a

Please sign in to comment.