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:
NIIBE Yutaka 2021-03-15 17:00:56 +09:00
parent 373b52e69a
commit f482e4bd12
1 changed files with 3 additions and 3 deletions

View File

@ -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--)