cpp: Add safety checks for key update
* lang/cpp/src/key.cpp (Key::update): Check that the key is not NULL. * lang/cpp/src/verificationresult.cpp (GpgME::Signature::key): Check for fingerprint.
This commit is contained in:
parent
4d1642b11e
commit
a6e5c8bf18
@ -347,6 +347,9 @@ const Key &Key::mergeWith(const Key &other)
|
|||||||
|
|
||||||
void Key::update()
|
void Key::update()
|
||||||
{
|
{
|
||||||
|
if (isNull() || !primaryFingerprint()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto ctx = Context::createForProtocol(protocol());
|
auto ctx = Context::createForProtocol(protocol());
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
return;
|
return;
|
||||||
|
@ -406,7 +406,7 @@ GpgME::Key GpgME::Signature::key(bool search, bool update) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
GpgME::Key ret = key();
|
GpgME::Key ret = key();
|
||||||
if (ret.isNull() && search) {
|
if (ret.isNull() && search && fingerprint ()) {
|
||||||
auto ctx = Context::createForProtocol (d->proto);
|
auto ctx = Context::createForProtocol (d->proto);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
ctx->setKeyListMode(KeyListMode::Local |
|
ctx->setKeyListMode(KeyListMode::Local |
|
||||||
|
Loading…
Reference in New Issue
Block a user