From 6c6b458959e4846c66ad6e7f265a9971037e18bc Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 1 Feb 1990 15:20:12 +0000 Subject: [PATCH] use krb5_mk_error instead of custom interface git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@225 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kdc/do_as_req.c | 9 +++++++-- src/kdc/do_tgs_req.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kdc/do_as_req.c b/src/kdc/do_as_req.c index 4718bc3c1..7ec02ff9a 100644 --- a/src/kdc/do_as_req.c +++ b/src/kdc/do_as_req.c @@ -251,7 +251,7 @@ krb5_data **response; { krb5_error errpkt; krb5_error_code retval; - + krb5_data *scratch; errpkt.ctime = request->ctime; errpkt.cmsec = 0; @@ -266,7 +266,12 @@ krb5_data **response; return ENOMEM; (void) strcpy(errpkt.text.data, error_message(error+KRB5KDC_ERR_NONE)); - retval = encode_krb5_error(&errpkt, response); + if (!(scratch = (krb5_data *)malloc(sizeof(*scratch)))) { + free(errpkt.txt.data); + return ENOMEM; + } + retval = encode_krb5_error(&errpkt, scratch); free(errpkt.text.data); + *response = scratch; return retval; } diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c index ef470d141..9b7f69f68 100644 --- a/src/kdc/do_tgs_req.c +++ b/src/kdc/do_tgs_req.c @@ -382,7 +382,7 @@ krb5_data **response; { krb5_error errpkt; krb5_error_code retval; - + krb5_data *scratch; errpkt.ctime = request->ctime; errpkt.cmsec = 0; @@ -397,8 +397,13 @@ krb5_data **response; return ENOMEM; (void) strcpy(errpkt.text.data, error_message(error+KRB5KDC_ERR_NONE)); - retval = encode_krb5_error(&errpkt, response); + if (!(scratch = (krb5_data *)malloc(sizeof(*scratch)))) { + free(errpkt.txt.data); + return ENOMEM; + } + retval = krb5_mk_error(&errpkt, scratch); free(errpkt.text.data); + *response = scratch; return retval; } -- 2.26.2