wire: reject NEW_CONNECTION_ID frames with zero-length conneciton IDs (#4180)

This commit is contained in:
Marten Seemann
2023-11-23 17:41:12 +07:00
committed by GitHub
parent 771d136fa9
commit 2d7ea37672
2 changed files with 13 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package wire
import (
"bytes"
"errors"
"fmt"
"io"
@@ -34,6 +35,9 @@ func parseNewConnectionIDFrame(r *bytes.Reader, _ protocol.VersionNumber) (*NewC
if err != nil {
return nil, err
}
if connIDLen == 0 {
return nil, errors.New("invalid zero-length connection ID")
}
connID, err := protocol.ReadConnectionID(r, int(connIDLen))
if err != nil {
return nil, err