1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common: Fix tlv-parser for constructed OCTET-STRING.

* common/tlv-parser.c (tlv_expect_octet_string): Fix assignment of N
value.

--

Before the change, need_octet_string_cramming returns always false,
because N==0.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2024-07-12 15:57:48 +09:00
parent 1e6b96577f
commit cc78b26a47
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -556,7 +556,10 @@ tlv_expect_octet_string (tlv_parser_t tlv, int encapsulates,
&& (!tlv->ti.is_constructed || encapsulates))) && (!tlv->ti.is_constructed || encapsulates)))
return (tlv->lasterr = gpg_error (GPG_ERR_INV_OBJ)); return (tlv->lasterr = gpg_error (GPG_ERR_INV_OBJ));
p = tlv->buffer; p = tlv->buffer;
if (!(n=tlv->ti.length) && !tlv->ti.ndef) n = tlv->ti.length;
if (!n && tlv->ti.ndef)
n = tlv->bufsize;
else if (!tlv->ti.length)
return (tlv->lasterr = gpg_error (GPG_ERR_TOO_SHORT)); return (tlv->lasterr = gpg_error (GPG_ERR_TOO_SHORT));
if (encapsulates && tlv->ti.is_constructed if (encapsulates && tlv->ti.is_constructed