From ee56cb33b25239cef9a0d41b911a20c8cd63193d Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 24 Jan 2022 00:31:27 -0500 Subject: [PATCH] lib/asn1: prevent wrong size argument warnings 190263bb7a56fc775b50a6cd0dc91820d2b2e5eb ("assert non-NULL ptrs before calling mem funcs") introduced two wrong size argument warnings. These locations are not errors since the allocation is simply to ensure that the data pointer is non-NULL; length is zero. Change-Id: I7b3b58247799a48da3653008c7b6d7fbbbf83e25 --- lib/asn1/der_copy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/asn1/der_copy.c b/lib/asn1/der_copy.c index 6e42e29b3..2084cef5f 100644 --- a/lib/asn1/der_copy.c +++ b/lib/asn1/der_copy.c @@ -124,7 +124,7 @@ der_copy_bmp_string (const heim_bmp_string *from, heim_bmp_string *to) { assert(from->length == 0 || (from->length > 0 && from->data != NULL)); if (from->length == 0) - to->data = calloc(1, 1); + to->data = calloc(1, sizeof(from->data[0])); else to->data = malloc(from->length * sizeof(from->data[0])); if (to->data == NULL) { @@ -143,7 +143,7 @@ der_copy_universal_string (const heim_universal_string *from, { assert(from->length == 0 || (from->length > 0 && from->data != NULL)); if (from->length == 0) - to->data = calloc(1, 1); + to->data = calloc(1, sizeof(from->data[0])); else to->data = malloc(from->length * sizeof(from->data[0])); if (to->data == NULL) {