From 21964d83bbacfb52bc7e1cf40e3def2c048a9468 Mon Sep 17 00:00:00 2001 From: Danilo Almeida Date: Wed, 4 Aug 1999 03:18:29 +0000 Subject: [PATCH] Intialize out_creds pointer to 0 and then check whether it is 0 before trying to dereference it, in case lower-level routine failed to assign a value to it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11619 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 7 +++++++ src/lib/krb5/krb/get_creds.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 2d795202d..10c4a2a44 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,10 @@ +1999-08-03 Danilo Almeida + + * get_creds.c (krb5_validate_or_renew_creds): Intialize out_creds + pointer to 0 and then check whether it is 0 before trying to + dereference it, in case lower-level routine failed to assign + a value to it. + 1999-07-22 Jeffrey Altman get_in_tkt.c: rename conf_boolean to krb5_conf_boolean so that diff --git a/src/lib/krb5/krb/get_creds.c b/src/lib/krb5/krb/get_creds.c index 37f2bb5a9..4fbf4cf33 100644 --- a/src/lib/krb5/krb/get_creds.c +++ b/src/lib/krb5/krb/get_creds.c @@ -226,7 +226,7 @@ krb5_validate_or_renew_creds(context, creds, client, ccache, in_tkt_service, { krb5_error_code ret; krb5_creds in_creds; /* only client and server need to be filled in */ - krb5_creds *out_creds; + krb5_creds *out_creds = 0; /* for check before dereferencing below */ krb5_creds **tgts; memset((char *)&in_creds, 0, sizeof(krb5_creds)); @@ -277,9 +277,10 @@ krb5_validate_or_renew_creds(context, creds, client, ccache, in_tkt_service, &in_creds, &out_creds, &tgts); /* ick. copy the struct contents, free the container */ - - *creds = *out_creds; - krb5_xfree(out_creds); + if (out_creds) { + *creds = *out_creds; + krb5_xfree(out_creds); + } cleanup: -- 2.26.2