mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...)
This commit is contained in:
parent
1933e38c1a
commit
d855e4cac8
2 changed files with 3 additions and 2 deletions
|
|
@ -142,7 +142,9 @@ CKey DecodeSecret(const std::string& str)
|
|||
key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed);
|
||||
}
|
||||
}
|
||||
memory_cleanse(data.data(), data.size());
|
||||
if (!data.empty()) {
|
||||
memory_cleanse(data.data(), data.size());
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue