forked from TrueCloudLab/neoneo-go
Merge pull request #1255 from nspcc-dev/p2p-handle-decompression-length-mismatch
network: handle length mismatch in decompression routine
This commit is contained in:
commit
3e192b11b2
1 changed files with 4 additions and 1 deletions
|
@ -30,5 +30,8 @@ func decompress(source []byte) ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return dest[:size], nil
|
if uint32(size) != length {
|
||||||
|
return nil, errors.New("decompressed payload size doesn't match header")
|
||||||
|
}
|
||||||
|
return dest, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue