From b3be9b7cd8f5f0e828d4d2aa6db1216ccd32ce3a Mon Sep 17 00:00:00 2001 From: Corey Lin <514971757@qq.com> Date: Thu, 13 Dec 2018 17:21:52 +0800 Subject: [PATCH] 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 --- accounts/usbwallet/ledger.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 }