Skip to content

Commit

Permalink
router: avoid out of range with empty path(#204)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Schmidt <git@julienschmidt.com>
  • Loading branch information
1046102779 and julienschmidt committed Sep 25, 2019
1 parent e62e5df commit 4fa1cc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (r *Router) DELETE(path string, handle Handle) {
// frequently used, non-standardized or custom methods (e.g. for internal
// communication with a proxy).
func (r *Router) Handle(method, path string, handle Handle) {
if path[0] != '/' {
if len(path) < 1 || path[0] != '/' {
panic("path must begin with '/' in path '" + path + "'")
}

Expand Down

0 comments on commit 4fa1cc7

Please sign in to comment.