Skip to content

Commit 6f8b6d3

Browse files
committed
don't try to decode invalid encoded ext keys
1 parent 8d2af54 commit 6f8b6d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/base58.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ template<typename K, int Size, CChainParams::Base58Type Type> class CBitcoinExtK
146146

147147
K GetKey() {
148148
K ret;
149-
ret.Decode(&vchData[0]);
149+
if (vchData.size() == Size) {
150+
//if base58 encouded data not holds a ext key, return a !IsValid() key
151+
ret.Decode(&vchData[0]);
152+
}
150153
return ret;
151154
}
152155

0 commit comments

Comments
 (0)