mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Merge pull request #20 from roseteromeo56/alert-autofix-1
Potential fix for code scanning alert no. 4: Size computation for allocation may overflow
This commit is contained in:
commit
e8b2dc2758
1 changed files with 3 additions and 0 deletions
|
|
@ -294,6 +294,9 @@ func (w *trezorDriver) trezorExchange(req proto.Message, results ...proto.Messag
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
if len(data) > math.MaxInt-8 {
|
||||||
|
return 0, errors.New("serialized data too large")
|
||||||
|
}
|
||||||
payload := make([]byte, 8+len(data))
|
payload := make([]byte, 8+len(data))
|
||||||
copy(payload, []byte{0x23, 0x23})
|
copy(payload, []byte{0x23, 0x23})
|
||||||
binary.BigEndian.PutUint16(payload[2:], trezor.Type(req))
|
binary.BigEndian.PutUint16(payload[2:], trezor.Type(req))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue