]> Sergey Matveev's repositories - btrtrc.git/commitdiff
mse: Error if initial payload exceeds maximum size
authorMatt Joiner <anacrolix@gmail.com>
Wed, 13 Sep 2017 06:18:15 +0000 (16:18 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 13 Sep 2017 06:18:15 +0000 (16:18 +1000)
mse/mse.go

index 421ade3fcba6813fee2bf5113264c6044bb30d5f..eb2480aaccf7247e2076276f7a6e8546907c6a68 100644 (file)
@@ -366,6 +366,10 @@ func (h *handshake) initerSteps() (ret io.ReadWriter, err error) {
        buf := &bytes.Buffer{}
        padLen := uint16(newPadLen())
        err = marshal(buf, vc[:], uint32(cryptoMethodRC4), padLen, zeroPad[:padLen], uint16(len(h.ia)), h.ia)
+       if len(h.ia) > math.MaxUint16 {
+               err = errors.New("initial payload too large")
+               return
+       }
        if err != nil {
                return
        }