Unverified Commit 0b9f6c5f authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

Merge pull request #43 from whyrusleeping/fix/utils/read-byte-array-maxlen

fix: enforce maxlen in ReadByteArray()
parents c568d328 4b1c7657
...@@ -470,8 +470,8 @@ func ReadByteArray(br io.Reader, maxlen uint64) ([]byte, error) { ...@@ -470,8 +470,8 @@ func ReadByteArray(br io.Reader, maxlen uint64) ([]byte, error) {
return nil, fmt.Errorf("expected cbor type 'byte string' in input") return nil, fmt.Errorf("expected cbor type 'byte string' in input")
} }
if extra > 256*1024 { if extra > maxlen {
return nil, fmt.Errorf("string in cbor input too long") return nil, fmt.Errorf("string in cbor input too long, maxlen: %d", maxlen)
} }
buf := make([]byte, extra) buf := make([]byte, extra)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment