libopensc: OID with only zeros in array do not valid
This commit is contained in:
parent
760cd1cfbd
commit
d525ca97e3
|
@ -231,6 +231,8 @@ int sc_pkcs15_parse_tokeninfo(sc_context_t *ctx,
|
|||
if (ti->preferred_language == NULL)
|
||||
return SC_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
sc_init_oid(&ti->profile_indication.oid);
|
||||
if (asn1_toki_attrs[13].flags & SC_ASN1_PRESENT) {
|
||||
if (asn1_profile_indication[0].flags & SC_ASN1_PRESENT) {
|
||||
sc_log(ctx, "ProfileIndication.oid present");
|
||||
|
|
|
@ -208,12 +208,19 @@ int sc_compare_oid(const struct sc_object_id *oid1, const struct sc_object_id *o
|
|||
|
||||
int sc_valid_oid(const struct sc_object_id *oid)
|
||||
{
|
||||
int ii;
|
||||
|
||||
if (!oid)
|
||||
return 0;
|
||||
if (oid->value[0] == -1 || oid->value[1] == -1)
|
||||
return 0;
|
||||
if (oid->value[0] > 2 || oid->value[1] > 39)
|
||||
return 0;
|
||||
for (ii=0;ii<SC_MAX_OBJECT_ID_OCTETS;ii++)
|
||||
if (oid->value[ii])
|
||||
break;
|
||||
if (ii==SC_MAX_OBJECT_ID_OCTETS)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue