cosmos-sdk/crypto/hd
Emmanuel T Odeke f970056a92
crypto/hd: make DerivePrivateKeyForPath error and not panic on trailing slashes (#8607)
Detected during my audit, right before fuzzing, the code that
checked for presence of hyphens per path segment assumed that
the part would always be non-empty. However, with paths such as:
* m/4/
* /44/
* m/4///

it'd panic with a runtime slice out of bounds.

With this new change, we now:
* firstly strip the right trailing slash
* on finding any empty segments of a path return an error

Fixes #8557
2021-02-17 10:30:04 +00:00
..
testdata Enter the new keyring interface (#5904) 2020-04-08 11:38:28 +02:00
algo.go Replace tmcrypto.PubKey by our own cryptotypes.PubKey (#7419) 2020-11-09 16:01:43 +00:00
algo_test.go Enter the new keyring interface (#5904) 2020-04-08 11:38:28 +02:00
doc.go Enter the new keyring interface (#5904) 2020-04-08 11:38:28 +02:00
fundraiser_test.go crypto/hd: add 'm/' prefix to hd path (#7970) 2020-11-18 18:42:45 +00:00
hdpath.go crypto/hd: make DerivePrivateKeyForPath error and not panic on trailing slashes (#8607) 2021-02-17 10:30:04 +00:00
hdpath_test.go crypto/hd: make DerivePrivateKeyForPath error and not panic on trailing slashes (#8607) 2021-02-17 10:30:04 +00:00