From 4d18c5ff52deb3f4abd8e2029a0be0ba0a30cfbf Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 1 Sep 2015 21:08:23 +0100 Subject: [PATCH] PGP: Added null check for passphrase_attempt --- src/pgp/gpg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c index 13a4608f..3d6bdc09 100644 --- a/src/pgp/gpg.c +++ b/src/pgp/gpg.c @@ -581,7 +581,9 @@ p_gpg_sign(const char * const str, const char * const fp) gpgme_free(signed_str); } - passphrase = strdup(passphrase_attempt); + if (passphrase_attempt) { + passphrase = strdup(passphrase_attempt); + } return result; } @@ -710,7 +712,9 @@ p_gpg_decrypt(const char * const cipher) } gpgme_free(plain_str); - passphrase = strdup(passphrase_attempt); + if (passphrase_attempt) { + passphrase = strdup(passphrase_attempt); + } return result; }