descriptor: check whitespace in ParsePubkeyInner

Due to Base58, keys with whitespace at the beginning or
at the end are successfully parsed. This commit adds a
check into `ParsePubkeyInner` to verify whether if the
first or last char of the key is a space.
This commit is contained in:
brunoerg 2024-12-31 11:16:42 -03:00
parent 50856695ef
commit cb722a3cea

View File

@ -1509,6 +1509,10 @@ std::vector<std::unique_ptr<PubkeyProvider>> ParsePubkeyInner(uint32_t key_exp_i
error = "No key provided";
return {};
}
if (IsSpace(str.front()) || IsSpace(str.back())) {
error = strprintf("Key '%s' is invalid due to whitespace", str);
return {};
}
if (split.size() == 1) {
if (IsHex(str)) {
std::vector<unsigned char> data = ParseHex(str);