From 6c9520273d39bef29f20a70e94f04ba782328ec4 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Fri, 2 Jul 1999 21:35:12 +0000 Subject: [PATCH] (copy_octet_string): don't fail if length == 0 and malloc returns NULL git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6388 ec53bebd-3082-4978-b11e-865c3cabbd6b --- 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 bd1c7442a..4e040631f 100644 --- a/lib/asn1/der_copy.c +++ b/lib/asn1/der_copy.c @@ -54,8 +54,8 @@ int copy_octet_string (const octet_string *from, octet_string *to) { to->length = from->length; - to->data = malloc(to->length); - if(to->data == NULL) + to->data = malloc(to->length); + if(to->length != 0 && to->data == NULL) return ENOMEM; memcpy(to->data, from->data, to->length); return 0;