mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* card-util.c (print_name): Fixed bad format string usage.
(print_isoname): Ditto. * trustdb.c (check_regexp): s/exp/expr/. * keyedit.c (trustsig_prompt): Removed a "> 255" term; it is always false due to the data type. * passphrase.c (agent_get_passphrase): Use xasprintf and avoid non-literal format strings. * tdbio.c (upd_hashtable, drop_from_hashtable, lookup_hashtable): Fixed log_error format string bugs. Kudos to the now working gcc-3.3 -Wformat-nonliteral and Florian Weimer's investigations in gnupg 1.2.3.
This commit is contained in:
parent
8ab35a7d26
commit
23fa5c9792
6 changed files with 49 additions and 35 deletions
31
g10/tdbio.c
31
g10/tdbio.c
|
@ -782,9 +782,9 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
|
|||
hashrec += msb / ITEMS_PER_HTBL_RECORD;
|
||||
rc = tdbio_read_record( hashrec, &rec, RECTYPE_HTBL );
|
||||
if( rc ) {
|
||||
log_error( db_name, "upd_hashtable: read failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
return rc;
|
||||
log_error ("upd_hashtable in `%s': read failed: %s\n", db_name,
|
||||
gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
item = rec.r.htbl.item[msb % ITEMS_PER_HTBL_RECORD];
|
||||
|
@ -792,8 +792,8 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
|
|||
rec.r.htbl.item[msb % ITEMS_PER_HTBL_RECORD] = newrecnum;
|
||||
rc = tdbio_write_record( &rec );
|
||||
if( rc ) {
|
||||
log_error( db_name, "upd_hashtable: write htbl failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
log_error ("upd_hashtable in `%s': write htbl failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -931,8 +931,8 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
|
|||
hashrec += msb / ITEMS_PER_HTBL_RECORD;
|
||||
rc = tdbio_read_record( hashrec, &rec, RECTYPE_HTBL );
|
||||
if( rc ) {
|
||||
log_error( db_name, "drop_from_hashtable: read failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
log_error ("drop_from_hashtable `%s': read failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -944,8 +944,8 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
|
|||
rec.r.htbl.item[msb % ITEMS_PER_HTBL_RECORD] = 0;
|
||||
rc = tdbio_write_record( &rec );
|
||||
if( rc )
|
||||
log_error( db_name, "drop_from_hashtable: write htbl failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
log_error ("drop_from_hashtable `%s': write htbl failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -973,8 +973,9 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
|
|||
rec.r.hlst.rnum[i] = 0; /* drop */
|
||||
rc = tdbio_write_record( &rec );
|
||||
if( rc )
|
||||
log_error( db_name, "drop_from_hashtable: write htbl failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
log_error ("drop_from_hashtable `%s': "
|
||||
"write htbl failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -1020,7 +1021,8 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
|
|||
hashrec += msb / ITEMS_PER_HTBL_RECORD;
|
||||
rc = tdbio_read_record( hashrec, rec, RECTYPE_HTBL );
|
||||
if( rc ) {
|
||||
log_error( db_name, "lookup_hashtable failed: %s\n", gpg_strerror (rc) );
|
||||
log_error ("lookup_hashtable in `%s' failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1030,14 +1032,15 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
|
|||
|
||||
rc = tdbio_read_record( item, rec, 0 );
|
||||
if( rc ) {
|
||||
log_error( db_name, "hashtable read failed: %s\n", gpg_strerror (rc) );
|
||||
log_error ("hashtable `%s' read failed: %s\n",
|
||||
db_name, gpg_strerror (rc) );
|
||||
return rc;
|
||||
}
|
||||
if( rec->rectype == RECTYPE_HTBL ) {
|
||||
hashrec = item;
|
||||
level++;
|
||||
if( level >= keylen ) {
|
||||
log_error( db_name, "hashtable has invalid indirections\n");
|
||||
log_error ("hashtable `%s' has invalid indirections\n", db_name);
|
||||
return GPG_ERR_TRUSTDB;
|
||||
}
|
||||
goto next_level;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue