otr: add missing return on error path

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 <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Adam Langley
2017-01-18 18:54:26 +00:00
parent 88e46b5e95
commit b8a2a83acf
+1
View File
@@ -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)
}