diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-05-28 21:20:05 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-05-28 21:20:05 +0800 |
commit | 9138955ba534ec074ecf55c4d02e2f3e72b29faa (patch) | |
tree | 168b70c8471929cbd10c7fb1190e7e30e726bd66 /cmd/geth/main.go | |
parent | 4baa5ca963552df6ed11112094f08111c8cf14bd (diff) | |
download | dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar.gz dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar.bz2 dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar.lz dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar.xz dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.tar.zst dexon-9138955ba534ec074ecf55c4d02e2f3e72b29faa.zip |
Validate account length and avoid slicing in logging
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r-- | cmd/geth/main.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index eecd7546a..f82a121e7 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -340,13 +340,13 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass var err error // Load startup keys. XXX we are going to need a different format - if len(account) == 0 { + if !((len(account) == 40) || (len(account) == 42)) { // with or without 0x utils.Fatalf("Invalid account address '%s'", account) } // Attempt to unlock the account 3 times attempts := 3 for tries := 0; tries < attempts; tries++ { - msg := fmt.Sprintf("Unlocking account %s...%s | Attempt %d/%d", account[:8], account[len(account)-6:], tries+1, attempts) + msg := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", account, tries+1, attempts) passphrase = getPassPhrase(ctx, msg, false) err = am.Unlock(common.HexToAddress(account), passphrase) if err == nil { |