mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
Potential fix for code scanning alert no. 4: Size computation for allocation may overflow
Romeo Rosete Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
a32388b614
commit
d445a08310
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 {
|
||||
return 0, err
|
||||
}
|
||||
if len(data) > math.MaxInt-8 {
|
||||
return 0, errors.New("serialized data too large")
|
||||
}
|
||||
payload := make([]byte, 8+len(data))
|
||||
copy(payload, []byte{0x23, 0x23})
|
||||
binary.BigEndian.PutUint16(payload[2:], trezor.Type(req))
|
||||
|
|
|
|||
Loading…
Reference in a new issue