Check domain name location index hasn't exceed maximum before setting

This commit is contained in:
Sean Parkinson
2019-11-06 08:28:09 +10:00
parent 165105af95
commit 52f28bd514

View File

@ -5117,8 +5117,10 @@ static int GetName(DecodedCert* cert, int nameType)
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen); XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen);
idx += strLen; idx += strLen;
#if defined(OPENSSL_EXTRA) #if defined(OPENSSL_EXTRA)
/* store order that DN was parsed */ if (count < DOMAIN_COMPONENT_MAX) {
dName->loc[count++] = id; /* store order that DN was parsed */
dName->loc[count++] = id;
}
#endif #endif
} }
@ -5191,8 +5193,10 @@ static int GetName(DecodedCert* cert, int nameType)
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen); XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen);
idx += strLen; idx += strLen;
#if defined(OPENSSL_EXTRA) #if defined(OPENSSL_EXTRA)
/* store order that DN was parsed */ if (count < DOMAIN_COMPONENT_MAX) {
dName->loc[count++] = id; /* store order that DN was parsed */
dName->loc[count++] = id;
}
#endif #endif
} }
@ -5276,8 +5280,10 @@ static int GetName(DecodedCert* cert, int nameType)
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], adv); XMEMCPY(&full[idx], &cert->source[cert->srcIdx], adv);
idx += adv; idx += adv;
#if defined(OPENSSL_EXTRA) #if defined(OPENSSL_EXTRA)
/* store order that DN was parsed */ if (count < DOMAIN_COMPONENT_MAX) {
dName->loc[count++] = ASN_EMAIL_NAME; /* store order that DN was parsed */
dName->loc[count++] = ASN_EMAIL_NAME;
}
#endif #endif
} }
} }
@ -5298,8 +5304,10 @@ static int GetName(DecodedCert* cert, int nameType)
dName->uidLen = adv; dName->uidLen = adv;
#ifdef OPENSSL_EXTRA #ifdef OPENSSL_EXTRA
/* store order that DN was parsed */ if (count < DOMAIN_COMPONENT_MAX) {
dName->loc[count++] = ASN_USER_ID; /* store order that DN was parsed */
dName->loc[count++] = ASN_USER_ID;
}
#endif #endif
#endif /* OPENSSL_EXTRA */ #endif /* OPENSSL_EXTRA */
break; break;
@ -5315,8 +5323,10 @@ static int GetName(DecodedCert* cert, int nameType)
dcnum++; dcnum++;
#ifdef OPENSSL_EXTRA #ifdef OPENSSL_EXTRA
/* store order that DN was parsed */ if (count < DOMAIN_COMPONENT_MAX) {
dName->loc[count++] = ASN_DOMAIN_COMPONENT; /* store order that DN was parsed */
dName->loc[count++] = ASN_DOMAIN_COMPONENT;
}
#endif #endif
#endif /* OPENSSL_EXTRA */ #endif /* OPENSSL_EXTRA */
break; break;