Skip to content

Commit

Permalink
otr: add missing return on error path
Browse files Browse the repository at this point in the history
Due to a missing return, corrupt TLV data would cause an infinite loop
that consumes memory, eventually crashing the process.

Thanks to Ivan Markin for pointing this out.

Change-Id: Iaaf7c5f7ce911d3e542b86f6b942b15e2ccbdf3b
Reviewed-on: https://go-review.googlesource.com/35247
Run-TryBot: Adam Langley <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
agl committed Jan 18, 2017
1 parent 88e46b5 commit b8a2a83
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions otr/otr.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ func (c *Conversation) processData(in []byte) (out []byte, tlvs []tlv, err error
t.data, tlvData, ok3 = getNBytes(tlvData, int(t.length))
if !ok1 || !ok2 || !ok3 {
err = errors.New("otr: corrupt tlv data")
return
}
tlvs = append(tlvs, t)
}
Expand Down

0 comments on commit b8a2a83

Please sign in to comment.