Merge pull request #4477 from luizluca/zero-terminate-constraints

ASN: zero-terminate name constraints strings
This commit is contained in:
David Garske
2021-10-19 21:16:46 -07:00
committed by GitHub

View File

@@ -15272,7 +15272,7 @@ static int DecodeSubtree(const byte* input, int sz, Base_entry** head,
return MEMORY_E;
}
entry->name = (char*)XMALLOC(strLength, heap, DYNAMIC_TYPE_ALTNAME);
entry->name = (char*)XMALLOC(strLength+1, heap, DYNAMIC_TYPE_ALTNAME);
if (entry->name == NULL) {
WOLFSSL_MSG("allocate error");
XFREE(entry, heap, DYNAMIC_TYPE_ALTNAME);
@@ -15280,6 +15280,7 @@ static int DecodeSubtree(const byte* input, int sz, Base_entry** head,
}
XMEMCPY(entry->name, &input[nameIdx], strLength);
entry->name[strLength] = '\0';
entry->nameSz = strLength;
entry->type = bType;