aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-07 18:05:35 +0000
committerWerner Koch <[email protected]>2016-01-07 18:09:16 +0000
commit8a56a38387c10c02ba0790c655dd5c1d08e4a724 (patch)
tree24ce7c5fa3c8fbb1f9fa7f17f9f12fbc327ae48a /g10/getkey.c
parentgpg: Fix warnings about useless assignments. (diff)
downloadgnupg-8a56a38387c10c02ba0790c655dd5c1d08e4a724.tar.gz
gnupg-8a56a38387c10c02ba0790c655dd5c1d08e4a724.zip
gpg: Avoid warnings about possible NULL deref.
* g10/getkey.c (cache_public_key): Protect deref of CE which actually can't happen. * g10/keygen.c (quickgen_set_para): s/sprintf/snprintf/. * g10/tofu.c (end_transaction, rollback_transaction): Allow NULL for DB. * g10/trustdb.c (update_min_ownertrust): Remove useless clearling of ERR. -- Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 6a1fce6da..e66be0de0 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -196,7 +196,7 @@ cache_public_key (PKT_public_key * pk)
/* Remove the last 50% of the entries. */
for (ce = pk_cache, n = 0; ce && n < pk_cache_entries/2; n++)
ce = ce->next;
- if (ce != pk_cache && ce->next)
+ if (ce && ce != pk_cache && ce->next)
{
ce2 = ce->next;
ce->next = NULL;