mirror of
git://git.gnupg.org/gnupg.git
synced 2025-06-21 20:57:57 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
008aa6e6d4
commit
8a56a38387
@ -196,7 +196,7 @@ cache_public_key (PKT_public_key * pk)
|
|||||||
/* Remove the last 50% of the entries. */
|
/* Remove the last 50% of the entries. */
|
||||||
for (ce = pk_cache, n = 0; ce && n < pk_cache_entries/2; n++)
|
for (ce = pk_cache, n = 0; ce && n < pk_cache_entries/2; n++)
|
||||||
ce = ce->next;
|
ce = ce->next;
|
||||||
if (ce != pk_cache && ce->next)
|
if (ce && ce != pk_cache && ce->next)
|
||||||
{
|
{
|
||||||
ce2 = ce->next;
|
ce2 = ce->next;
|
||||||
ce->next = NULL;
|
ce->next = NULL;
|
||||||
|
@ -3395,7 +3395,7 @@ quickgen_set_para (struct para_data_s *para, int for_subkey,
|
|||||||
para = r;
|
para = r;
|
||||||
r = xmalloc_clear (sizeof *r + 20);
|
r = xmalloc_clear (sizeof *r + 20);
|
||||||
r->key = for_subkey? pSUBKEYTYPE : pKEYTYPE;
|
r->key = for_subkey? pSUBKEYTYPE : pKEYTYPE;
|
||||||
sprintf (r->u.value, "%d", algo);
|
snprintf (r->u.value, 20, "%d", algo);
|
||||||
r->next = para;
|
r->next = para;
|
||||||
para = r;
|
para = r;
|
||||||
|
|
||||||
|
@ -306,6 +306,9 @@ end_transaction (struct db *db, int only_batch)
|
|||||||
int rc;
|
int rc;
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
|
|
||||||
|
if (!db)
|
||||||
|
return 0; /* Shortcut to allow for easier cleanup code. */
|
||||||
|
|
||||||
if ((! batch_update || only_batch == 2) && db->batch_update)
|
if ((! batch_update || only_batch == 2) && db->batch_update)
|
||||||
/* The batch transaction is still in open, but we left batch
|
/* The batch transaction is still in open, but we left batch
|
||||||
mode. */
|
mode. */
|
||||||
@ -353,6 +356,9 @@ rollback_transaction (struct db *db)
|
|||||||
int rc;
|
int rc;
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
|
|
||||||
|
if (!db)
|
||||||
|
return 0; /* Shortcut to allow for easier cleanup code. */
|
||||||
|
|
||||||
if (db->batch_update)
|
if (db->batch_update)
|
||||||
/* Just undo the most recent update; don't revert any progress
|
/* Just undo the most recent update; don't revert any progress
|
||||||
made by the batch transaction. */
|
made by the batch transaction. */
|
||||||
|
@ -781,7 +781,6 @@ update_min_ownertrust (u32 *kid, unsigned int new_trust )
|
|||||||
write_record (&rec);
|
write_record (&rec);
|
||||||
tdb_revalidation_mark ();
|
tdb_revalidation_mark ();
|
||||||
do_sync ();
|
do_sync ();
|
||||||
err = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user