mirror of
https://github.com/jwetzell/psn-go.git
synced 2026-08-12 19:03:50 +00:00
add size check to chunk datalen
This commit is contained in:
@@ -30,6 +30,10 @@ func DecodeChunk(bytes []byte) (chunks.Chunk, error) {
|
||||
HasSubchunks: has_subchunks,
|
||||
}
|
||||
|
||||
if len(bytes) < 4+int(header.DataLen) {
|
||||
return chunks.Chunk{}, errors.New("chunk data length is greater than the number of bytes")
|
||||
}
|
||||
|
||||
chunk_data := bytes[4 : 4+header.DataLen]
|
||||
|
||||
return chunks.Chunk{
|
||||
|
||||
Reference in New Issue
Block a user