diff --git a/http2/frame.go b/http2/frame.go index 514c126c5..8ab05bf2a 100644 --- a/http2/frame.go +++ b/http2/frame.go @@ -1018,7 +1018,7 @@ func parseHeadersFrame(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err er return nil, err } } - if len(p)-int(padLength) <= 0 { + if int(padLength) > len(p) { return nil, streamError(fh.StreamID, ErrCodeProtocol) } hf.headerFragBuf = p[:len(p)-int(padLength)]