about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-09-01 21:08:23 +0100
committerJames Booth <boothj5@gmail.com>2015-09-01 21:08:23 +0100
commit4d18c5ff52deb3f4abd8e2029a0be0ba0a30cfbf (patch)
tree9e0e5fc1b4db2b64051d6a2990f24f0afed1b472
parent53035f5e4cdb1157478ab6602647e1feb67dbe30 (diff)
downloadprofani-tty-4d18c5ff52deb3f4abd8e2029a0be0ba0a30cfbf.tar.gz
PGP: Added null check for passphrase_attempt
-rw-r--r--src/pgp/gpg.c8
1 files 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;
 }