mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-16 21:16:37 +00:00
fixes missing protection of nil pointer dereference in scwallet (#32186)
Fixes #32181 Signed-off-by: kapil <kapilsareen584@gmail.com>
This commit is contained in:
parent
44fc0c8706
commit
39ab721992
1 changed files with 14 additions and 9 deletions
|
|
@ -472,6 +472,11 @@ func (w *Wallet) selfDerive() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
pairing := w.Hub.pairing(w)
|
pairing := w.Hub.pairing(w)
|
||||||
|
if pairing == nil {
|
||||||
|
w.lock.Unlock()
|
||||||
|
reqc <- struct{}{}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Device lock obtained, derive the next batch of accounts
|
// Device lock obtained, derive the next batch of accounts
|
||||||
var (
|
var (
|
||||||
|
|
@ -631,13 +636,13 @@ func (w *Wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
|
||||||
}
|
}
|
||||||
|
|
||||||
if pin {
|
if pin {
|
||||||
pairing := w.Hub.pairing(w)
|
if pairing := w.Hub.pairing(w); pairing != nil {
|
||||||
pairing.Accounts[account.Address] = path
|
pairing.Accounts[account.Address] = path
|
||||||
if err := w.Hub.setPairing(w, pairing); err != nil {
|
if err := w.Hub.setPairing(w, pairing); err != nil {
|
||||||
return accounts.Account{}, err
|
return accounts.Account{}, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return account, nil
|
return account, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -774,11 +779,11 @@ func (w *Wallet) SignTxWithPassphrase(account accounts.Account, passphrase strin
|
||||||
// It first checks for the address in the list of pinned accounts, and if it is
|
// It first checks for the address in the list of pinned accounts, and if it is
|
||||||
// not found, attempts to parse the derivation path from the account's URL.
|
// not found, attempts to parse the derivation path from the account's URL.
|
||||||
func (w *Wallet) findAccountPath(account accounts.Account) (accounts.DerivationPath, error) {
|
func (w *Wallet) findAccountPath(account accounts.Account) (accounts.DerivationPath, error) {
|
||||||
pairing := w.Hub.pairing(w)
|
if pairing := w.Hub.pairing(w); pairing != nil {
|
||||||
if path, ok := pairing.Accounts[account.Address]; ok {
|
if path, ok := pairing.Accounts[account.Address]; ok {
|
||||||
return path, nil
|
return path, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for the path in the URL
|
// Look for the path in the URL
|
||||||
if account.URL.Scheme != w.Hub.scheme {
|
if account.URL.Scheme != w.Hub.scheme {
|
||||||
return nil, fmt.Errorf("scheme %s does not match wallet scheme %s", account.URL.Scheme, w.Hub.scheme)
|
return nil, fmt.Errorf("scheme %s does not match wallet scheme %s", account.URL.Scheme, w.Hub.scheme)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue