mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 14:26:26 +00:00
Fix a potential OOB error in SSZ deserialization
This commit is contained in:
parent
c39d4f1817
commit
a336285922
@ -80,7 +80,8 @@ proc readSszValue*(input: openarray[byte], T: type): T =
|
||||
type ElemType = type result[0]
|
||||
when ElemType is byte|char:
|
||||
result.setLen input.len
|
||||
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
||||
if input.len > 0:
|
||||
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
||||
|
||||
elif isFixedSize(ElemType):
|
||||
const elemSize = fixedPortionSize(ElemType)
|
||||
|
Loading…
x
Reference in New Issue
Block a user