forked from wolfSSL/wolfssl
Fix for general name parsing with WOLFSSL_ASN_TEMPLATE
to use right length for general names and properly NULL terminate.
This commit is contained in:
@ -13500,7 +13500,7 @@ static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Check against the excluded list */
|
/* Check against the excluded list */
|
||||||
if (signer->excludedNames) {
|
if (signer->excludedNames != NULL) {
|
||||||
Base_entry* base = signer->excludedNames;
|
Base_entry* base = signer->excludedNames;
|
||||||
|
|
||||||
while (base != NULL) {
|
while (base != NULL) {
|
||||||
@ -15341,7 +15341,7 @@ static int DecodeSubtreeGeneralName(const byte* input, int sz, byte tag,
|
|||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Allocate name. */
|
/* Allocate name. */
|
||||||
entry->name = (char*)XMALLOC(len, heap, DYNAMIC_TYPE_ALTNAME);
|
entry->name = (char*)XMALLOC(len + 1, heap, DYNAMIC_TYPE_ALTNAME);
|
||||||
if (entry->name == NULL) {
|
if (entry->name == NULL) {
|
||||||
XFREE(entry, heap, DYNAMIC_TYPE_ALTNAME);
|
XFREE(entry, heap, DYNAMIC_TYPE_ALTNAME);
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
@ -15350,6 +15350,7 @@ static int DecodeSubtreeGeneralName(const byte* input, int sz, byte tag,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Store name, size and tag in object. */
|
/* Store name, size and tag in object. */
|
||||||
XMEMCPY(entry->name, &input[nameIdx], len);
|
XMEMCPY(entry->name, &input[nameIdx], len);
|
||||||
|
entry->name[len] = '\0';
|
||||||
entry->nameSz = len;
|
entry->nameSz = len;
|
||||||
entry->type = tag & ASN_TYPE_MASK;
|
entry->type = tag & ASN_TYPE_MASK;
|
||||||
|
|
||||||
@ -15476,7 +15477,7 @@ static int DecodeSubtree(const byte* input, int sz, Base_entry** head,
|
|||||||
/* Parse the general name and store a new entry. */
|
/* Parse the general name and store a new entry. */
|
||||||
ret = DecodeSubtreeGeneralName(input +
|
ret = DecodeSubtreeGeneralName(input +
|
||||||
GetASNItem_DataIdx(dataASN[1], input),
|
GetASNItem_DataIdx(dataASN[1], input),
|
||||||
GetASNItem_EndIdx(dataASN[1], input), t, head, heap);
|
dataASN[1].length, t, head, heap);
|
||||||
}
|
}
|
||||||
/* Skip entry. */
|
/* Skip entry. */
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user