Skip to content

Commit

Permalink
Fix directory traversal vulnerability under Windows (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
m3ng9i committed Aug 19, 2021
1 parent 06c4cf7 commit fcfc1a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func newContext(config Config, r *http.Request) (c *context, err error) {

requestPath := r.URL.Path

// Fix directory traversal vulnerability under Windows, see https://github.com/m3ng9i/ran/issues/29
requestPath = strings.ReplaceAll(requestPath, `\`, `/`)

if !strings.HasPrefix(requestPath, "/") {
requestPath = "/" + requestPath
}
Expand Down

0 comments on commit fcfc1a1

Please sign in to comment.