Skip to content

Commit

Permalink
usbwallet: check returned error when decoding hexstr (ethereum#18056)
Browse files Browse the repository at this point in the history
* usbwallet: check returned error when decoding hexstr

* Update accounts/usbwallet/ledger.go

Co-Authored-By: CoreyLin <[email protected]>

* usbwallet: check hex decode error
  • Loading branch information
gzliudan committed Jan 14, 2025
1 parent fda5e53 commit 97e82de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion accounts/usbwallet/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ func (w *ledgerDriver) ledgerDerive(derivationPath []uint32) (common.Address, er

// Decode the hex sting into an Ethereum address and return
var address common.Address
hex.Decode(address[:], hexstr)
if _, err = hex.Decode(address[:], hexstr); err != nil {
return common.Address{}, err
}
return address, nil
}

Expand Down

0 comments on commit 97e82de

Please sign in to comment.