mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-02 21:11:05 +01:00
scd: Fix count_sos_bits handling.
* scd/app-openpgp.c (count_sos_bits): Handle an exceptional case. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
373b52e69a
commit
f482e4bd12
@ -723,7 +723,7 @@ count_sos_bits (const unsigned char *a, size_t len)
|
||||
unsigned int n = len * 8;
|
||||
int i;
|
||||
|
||||
if (*a == 0)
|
||||
if (len == 0 || *a == 0)
|
||||
return n;
|
||||
|
||||
for (i=7; i && !(*a & (1<<i)); i--)
|
||||
@ -912,11 +912,11 @@ store_fpr (app_t app, int keynumber, u32 timestamp, unsigned char *fpr,
|
||||
*p++ = nbits;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
{
|
||||
nbits = count_sos_bits (m[i], mlen[i]);
|
||||
*p++ = nbits >> 8;
|
||||
*p++ = nbits;
|
||||
}
|
||||
}
|
||||
memcpy (p, m[i], mlen[i]);
|
||||
p += mlen[i];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user