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
This commit is contained in:
Corey Lin 2018-12-13 17:21:52 +08:00 committed by Martin Holst Swende
parent 4e6f53ac33
commit b3be9b7cd8

View File

@ -257,7 +257,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
}