Skip to content

Commit b3be9b7

Browse files
CoreyLinholiman
authored andcommitted
usbwallet: check returned error when decoding hexstr (#18056)
* usbwallet: check returned error when decoding hexstr * Update accounts/usbwallet/ledger.go Co-Authored-By: CoreyLin <514971757@qq.com> * usbwallet: check hex decode error
1 parent 4e6f53a commit b3be9b7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎accounts/usbwallet/ledger.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ func (w *ledgerDriver) ledgerDerive(derivationPath []uint32) (common.Address, er
257257

258258
// Decode the hex sting into an Ethereum address and return
259259
var address common.Address
260-
hex.Decode(address[:], hexstr)
260+
if _, err = hex.Decode(address[:], hexstr); err != nil {
261+
return common.Address{}, err
262+
}
261263
return address, nil
262264
}
263265

0 commit comments

Comments
 (0)