mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
gpg: Fix wrong Tofu DB consistency check.
* g10/tofu.c (build_conflict_set): Do not assume MAX_FINGERPRINT_LEN is the size of the fingerprint. -- This problem was exhibited by commit ecbbafb88d920e713439b6b1b8e1b41a6f8d0e38. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
825abec0e7
commit
18e5946aef
11
g10/tofu.c
11
g10/tofu.c
@ -2083,13 +2083,16 @@ build_conflict_set (ctrl_t ctrl, tofu_dbs_t dbs,
|
|||||||
* policy to ask due to a conflict. */
|
* policy to ask due to a conflict. */
|
||||||
for (iter = conflict_set; iter; iter = iter->next)
|
for (iter = conflict_set; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
|
/* Fixme: Why the check against N+1? */
|
||||||
int l = strlen (iter->d);
|
int l = strlen (iter->d);
|
||||||
if (!(l == 2 * MAX_FINGERPRINT_LEN
|
if (!(l == 2 * 20
|
||||||
|| l == 2 * MAX_FINGERPRINT_LEN + 1))
|
|| l == 2 * 20 + 1
|
||||||
|
|| l == 2 * 32
|
||||||
|
|| l == 2 * 32 + 1))
|
||||||
{
|
{
|
||||||
log_error (_("TOFU db corruption detected.\n"));
|
log_error (_("TOFU db corruption detected.\n"));
|
||||||
print_further_info ("fingerprint '%s' is not %d characters long",
|
print_further_info ("fingerprint '%s' is %d characters long",
|
||||||
iter->d, 2 * MAX_FINGERPRINT_LEN);
|
iter->d, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l >= 1 && iter->d[l - 1] == '!')
|
if (l >= 1 && iter->d[l - 1] == '!')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user