From 43644d9a789f80c504ff4a019bb420803a1f9136 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 11 Oct 1990 00:58:42 +0000 Subject: [PATCH] need to allocate, not call ourselves. need to put something in the structure, even if it's nothing. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1245 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/asn.1/ktgrq2tgrq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/krb5/asn.1/ktgrq2tgrq.c b/src/lib/krb5/asn.1/ktgrq2tgrq.c index 0fad014ff..c14be7acf 100644 --- a/src/lib/krb5/asn.1/ktgrq2tgrq.c +++ b/src/lib/krb5/asn.1/ktgrq2tgrq.c @@ -35,12 +35,14 @@ register int *error; { register struct type_KRB5_KDC__REQ__BODY *retval; - retval = krb5_kdc_req2KRB5_KDC__REQ__BODY(val, error); + retval = (struct type_KRB5_KDC__REQ__BODY *)xmalloc(sizeof(*retval)); if (!retval) { *error = ENOMEM; return(0); } + xbzero(retval, sizeof(*retval)); + retval->kdc__options = krb5_kdcoptions2KRB5_KDCOptions(val->kdc_options, error); @@ -108,13 +110,13 @@ register int *error; /* count elements */ for (i = 0, temp = val->second_ticket; *temp; temp++,i++); - adtk = (struct element_KRB5_6 *)xmalloc(sizeof(*retval) + + adtk = (struct element_KRB5_6 *)xmalloc(sizeof(*adtk) + max(0,i-1)*sizeof(adtk->Ticket)); if (!adtk) { *error = ENOMEM; goto errout; } - xbzero(adtk, sizeof(adtk)); + xbzero(adtk, sizeof(*adtk)); adtk->nelem = i; for (i = 0; i < adtk->nelem; i++) { adtk->Ticket[i] = krb5_ticket2KRB5_Ticket(val->second_ticket[i], @@ -129,7 +131,18 @@ register int *error; } } retval->additional__tickets = adtk; + } else { + struct element_KRB5_6 *adtk; + adtk = (struct element_KRB5_6 *)xmalloc(sizeof(*adtk)); + if (!adtk) { + *error = ENOMEM; + goto errout; + } + xbzero(adtk, sizeof(*adtk)); + adtk->nelem = 0; + retval->additional__tickets = adtk; } + return retval; } -- 2.26.2