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.
Run-TryBot: Adam Langley
TryBot-Result: Gobot Gobot
@@ -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)
}
