- Do not barf on empty SEQUENCEs if all elements inside are OPTIONAL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1386 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
093adc8c89
commit
3c88da0d81
|
@ -1035,10 +1035,13 @@ static int asn1_decode(struct sc_context *ctx, struct sc_asn1_entry *asn1,
|
|||
if (ctx->debug >= 3)
|
||||
debug(ctx, "called, depth %d%s\n", depth, choice ? ", choice" : "");
|
||||
if (left < 2) {
|
||||
if (asn1->name != NULL)
|
||||
return SC_ERROR_ASN1_END_OF_CONTENTS;
|
||||
else
|
||||
while (asn1->name && (asn1->flags & SC_ASN1_OPTIONAL))
|
||||
asn1++;
|
||||
/* If all elements were optional, there's nothing
|
||||
* to complain about */
|
||||
if (asn1->name == NULL)
|
||||
return 0;
|
||||
return SC_ERROR_ASN1_END_OF_CONTENTS;
|
||||
}
|
||||
if (p[0] == 0 || p[0] == 0xFF)
|
||||
return SC_ERROR_ASN1_END_OF_CONTENTS;
|
||||
|
|
Loading…
Reference in New Issue