From c3e1233f6318315a6c90f058873060d9a837100f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 12 Apr 2006 16:20:03 +0000 Subject: [PATCH] (krb5_rd_safe): fix argument to krb5_data_zero, handle message size = 0 git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17057 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/rd_safe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/krb5/rd_safe.c b/lib/krb5/rd_safe.c index 90594c62a..0633997fa 100644 --- a/lib/krb5/rd_safe.c +++ b/lib/krb5/rd_safe.c @@ -93,8 +93,8 @@ krb5_rd_safe(krb5_context context, KRB_SAFE safe; size_t len; - if (outdata) - krb5_data_zero(outdata); + if (outbuf) + krb5_data_zero(outbuf); if ((auth_context->flags & (KRB5_AUTH_CONTEXT_RET_TIME | KRB5_AUTH_CONTEXT_RET_SEQUENCE)) && @@ -184,13 +184,13 @@ 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) { + if (outbuf->data == NULL && outbuf->length != 0) { ret = ENOMEM; krb5_set_error_string (context, "malloc: out of memory"); 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 &