diff options
author | NIIBE Yutaka <[email protected]> | 2021-03-15 08:00:56 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2021-03-15 08:00:56 +0000 |
commit | f482e4bd121ff2862bfb53a82f1d5c2cf3524a10 (patch) | |
tree | 2a31a5c303e133dc6f25a60d48580231e0e01515 /scd/app-openpgp.c | |
parent | common: Fix the NBITS of Ed448in OIDTABLE. (diff) | |
download | gnupg-f482e4bd121ff2862bfb53a82f1d5c2cf3524a10.tar.gz gnupg-f482e4bd121ff2862bfb53a82f1d5c2cf3524a10.zip |
scd: Fix count_sos_bits handling.
* scd/app-openpgp.c (count_sos_bits): Handle an exceptional case.
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r-- | scd/app-openpgp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index fcae4d713..626350e3c 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -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]; } |