heimdal/asn1: do not throw error when trying to allocate 0 bytes of memory

This commit is contained in:
Norbert Bokor
2022-12-01 11:08:46 +01:00
committed by Nico Williams
parent 6dc36f99c0
commit 14aca7a831

View File

@@ -3015,7 +3015,7 @@ _asn1_copy(const struct asn1_template *t, const void *from, void *to)
unsigned int i;
tel->val = calloc(fel->len, ellen);
if (tel->val == NULL)
if (tel->val == NULL && fel->len > 0)
return ENOMEM;
tel->len = fel->len;