From d52fe4e20a92340e8c219b3c0e580cb1c8d156ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 11 Jan 2007 02:54:59 +0000 Subject: [PATCH] (krb5_rd_safe): set length before trying to allocate data git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19827 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/rd_safe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/krb5/rd_safe.c b/lib/krb5/rd_safe.c index 0633997fa..0ed46a35e 100644 --- a/lib/krb5/rd_safe.c +++ b/lib/krb5/rd_safe.c @@ -184,13 +184,14 @@ krb5_rd_safe(krb5_context context, if (ret) goto failure; + outbuf->length = safe.safe_body.user_data.length; outbuf->data = malloc(outbuf->length); if (outbuf->data == NULL && outbuf->length != 0) { ret = ENOMEM; krb5_set_error_string (context, "malloc: out of memory"); + krb5_data_zero(outbuf); goto failure; } - outbuf->length = safe.safe_body.user_data.length; memcpy (outbuf->data, safe.safe_body.user_data.data, outbuf->length); if ((auth_context->flags &