reject MAX_STREAMS frames with too large stream counts

This commit is contained in:
Marten Seemann 2019-03-29 09:33:28 +01:00
parent 358fce241a
commit 7b02b87026
3 changed files with 15 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/lucas-clemente/quic-go/internal/flowcontrol"
"github.com/lucas-clemente/quic-go/internal/handshake"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/qerr"
"github.com/lucas-clemente/quic-go/internal/wire"
)
@ -159,6 +160,9 @@ func (m *streamsMap) GetOrOpenSendStream(id protocol.StreamID) (sendStreamI, err
}
func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) error {
if f.MaxStreams > protocol.MaxStreamCount {
return qerr.StreamLimitError
}
id := protocol.MaxStreamID(f.Type, f.MaxStreams, m.perspective)
switch id.Type() {
case protocol.StreamTypeUni: