validate connection ID length in preferred_address transport parameter

This commit is contained in:
Marten Seemann 2020-04-08 14:12:53 +07:00
parent 799d80197f
commit 96ac90e6be
2 changed files with 30 additions and 8 deletions

View file

@ -214,6 +214,9 @@ func (p *TransportParameters) readPreferredAddress(r *bytes.Reader, expectedLen
if err != nil {
return err
}
if connIDLen == 0 || connIDLen > protocol.MaxConnIDLen {
return fmt.Errorf("invalid connection ID length: %d", connIDLen)
}
connID, err := protocol.ReadConnectionID(r, int(connIDLen))
if err != nil {
return err