Skip to content

Commit dc96693

Browse files
committed
fix: DoS issue when To header is not present
Thanks to Sandro Gauci from Enable Security for reporting issue
1 parent 02f40de commit dc96693

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sip/response.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ func NewResponseFromRequest(
239239
case 100:
240240
CopyHeaders("Timestamp", req, res)
241241
default:
242-
if _, ok := res.To().Params["tag"]; !ok {
243-
uuid, _ := uuid.NewRandom()
244-
res.to.Params["tag"] = uuid.String()
242+
if h := res.To(); h != nil {
243+
if _, ok := h.Params["tag"]; !ok {
244+
h.Params["tag"] = uuid.NewString()
245+
}
245246
}
246247
}
247248

0 commit comments

Comments
 (0)