aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Lin <514971757@qq.com>2018-12-13 17:21:52 +0800
committerMartin Holst Swende <martin@swende.se>2018-12-13 17:21:52 +0800
commitb3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a (patch)
treec70cb5dfc8129a52a3ae24b3c23ab93354eb7de8
parent4e6f53ac3360c4e90fdb419e7073e4316b2a49f7 (diff)
downloaddexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar.gz
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar.bz2
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar.lz
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar.xz
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.tar.zst
dexon-b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a.zip
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
-rw-r--r--accounts/usbwallet/ledger.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/accounts/usbwallet/ledger.go b/accounts/usbwallet/ledger.go
index 7d5f67908..c30903b5b 100644
--- a/accounts/usbwallet/ledger.go
+++ b/accounts/usbwallet/ledger.go
@@ -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
}