From 14aca7a8314e16e039ec3786facf8fc22a40219f Mon Sep 17 00:00:00 2001 From: Norbert Bokor Date: Thu, 1 Dec 2022 11:08:46 +0100 Subject: [PATCH] heimdal/asn1: do not throw error when trying to allocate 0 bytes of memory --- lib/asn1/template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asn1/template.c b/lib/asn1/template.c index c2112174b..ed215d888 100644 --- a/lib/asn1/template.c +++ b/lib/asn1/template.c @@ -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;