Update dependencies

This commit is contained in:
Ken-Håvard Lieng 2019-06-09 02:01:48 +02:00
parent 7ad76273c0
commit 540efa03c4
485 changed files with 57821 additions and 12429 deletions

View file

@ -57,7 +57,7 @@ func (h *Header) String() string {
// This may differ from the wire format, depending on the system.
func (h *Header) Marshal() ([]byte, error) {
if h == nil {
return nil, errInvalidConn
return nil, errNilHeader
}
if h.Len < HeaderLen {
return nil, errHeaderTooShort
@ -107,12 +107,15 @@ func (h *Header) Marshal() ([]byte, error) {
// local system.
// This may differ from the wire format, depending on the system.
func (h *Header) Parse(b []byte) error {
if h == nil || len(b) < HeaderLen {
if h == nil || b == nil {
return errNilHeader
}
if len(b) < HeaderLen {
return errHeaderTooShort
}
hdrlen := int(b[0]&0x0f) << 2
if hdrlen > len(b) {
return errBufferTooShort
if len(b) < hdrlen {
return errExtHeaderTooShort
}
h.Version = int(b[0] >> 4)
h.Len = hdrlen