Skip to content

Commit 643895b

Browse files
committed
httptransport: Check MediaType can be split on /
It is possible for a client to manifest a panic by sending invalid Accept header. Signed-off-by: crozzy <[email protected]>
1 parent 81d17e1 commit 643895b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

httptransport/common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ func pickContentType(w http.ResponseWriter, r *http.Request, allow []string) err
6767
a.Q, _ = strconv.ParseFloat(qs, 64)
6868
}
6969
typ := strings.Split(mt, "/")
70+
if len(typ) != 2 {
71+
return fmt.Errorf("malformed Accept value %s", mt)
72+
}
7073
a.Type = typ[0]
7174
a.Subtype = typ[1]
7275
acceptable = append(acceptable, a)

0 commit comments

Comments
 (0)