Fix a potential OOB error in SSZ deserialization
This commit is contained in:
parent
c39d4f1817
commit
a336285922
|
@ -80,6 +80,7 @@ proc readSszValue*(input: openarray[byte], T: type): T =
|
||||||
type ElemType = type result[0]
|
type ElemType = type result[0]
|
||||||
when ElemType is byte|char:
|
when ElemType is byte|char:
|
||||||
result.setLen input.len
|
result.setLen input.len
|
||||||
|
if input.len > 0:
|
||||||
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
||||||
|
|
||||||
elif isFixedSize(ElemType):
|
elif isFixedSize(ElemType):
|
||||||
|
|
Loading…
Reference in New Issue