From b172afd1cc8015a707719e8560e83239613c1f97 Mon Sep 17 00:00:00 2001 From: Lin Corey Date: Thu, 8 Nov 2018 10:48:02 +0800 Subject: [PATCH] usbwallet: check returned error when decoding hexstr --- accounts/usbwallet/ledger.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accounts/usbwallet/ledger.go b/accounts/usbwallet/ledger.go index 7d5f67908d..9b7ca181fc 100644 --- a/accounts/usbwallet/ledger.go +++ b/accounts/usbwallet/ledger.go @@ -257,7 +257,10 @@ 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) + _, err = hex.Decode(address[:], hexstr) + if err != nil { + return common.Address{}, err + } return address, nil }