From e520087f913f7fd2855fc7d53d10f3dd4107a800 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sat, 19 Jul 1997 02:06:35 +0000 Subject: [PATCH] Check result of malloc. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2457 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/asn1/der_copy.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/asn1/der_copy.c b/lib/asn1/der_copy.c index 967750490..bd1c7442a 100644 --- a/lib/asn1/der_copy.c +++ b/lib/asn1/der_copy.c @@ -40,17 +40,23 @@ RCSID("$Id$"); -void +int copy_general_string (const general_string *from, general_string *to) { *to = malloc(strlen(*from) + 1); + if(*to == NULL) + return ENOMEM; strcpy(*to, *from); + return 0; } -void +int copy_octet_string (const octet_string *from, octet_string *to) { to->length = from->length; to->data = malloc(to->length); + if(to->data == NULL) + return ENOMEM; memcpy(to->data, from->data, to->length); + return 0; }