Work around memory-aliasing in descriptor ParsePubkey

This commit is contained in:
MarcoFalke 2020-07-13 22:00:40 +02:00
parent 37485baa27
commit fa8a992589
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -826,7 +826,8 @@ std::unique_ptr<PubkeyProvider> ParsePubkey(uint32_t key_exp_index, const Span<c
} }
if (origin_split.size() == 1) return ParsePubkeyInner(key_exp_index, origin_split[0], permit_uncompressed, out, error); if (origin_split.size() == 1) return ParsePubkeyInner(key_exp_index, origin_split[0], permit_uncompressed, out, error);
if (origin_split[0].size() < 1 || origin_split[0][0] != '[') { if (origin_split[0].size() < 1 || origin_split[0][0] != '[') {
error = strprintf("Key origin start '[ character expected but not found, got '%c' instead", origin_split[0][0]); error = strprintf("Key origin start '[ character expected but not found, got '%c' instead",
origin_split[0].size() < 1 ? /** empty, implies split char */ ']' : origin_split[0][0]);
return nullptr; return nullptr;
} }
auto slash_split = Split(origin_split[0].subspan(1), '/'); auto slash_split = Split(origin_split[0].subspan(1), '/');