mirror of
https://github.com/jwetzell/psn-go.git
synced 2026-09-04 22:09:13 +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,
|
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]
|
chunk_data := bytes[4 : 4+header.DataLen]
|
||||||
|
|
||||||
return chunks.Chunk{
|
return chunks.Chunk{
|
||||||
|
|||||||
Reference in New Issue
Block a user