summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeffrey Altman <jaltman@secure-endpoints.com>2008-07-21 17:44:43 +0000
committerJeffrey Altman <jaltman@secure-endpoints.com>2008-07-21 17:44:43 +0000
commitc618db64af29b04b651cc8f354eec4ef7cbc5298 (patch)
tree9e2bb5620aaa558a17ff7e3caae3e2a49b7b5e53 /src
parentf31c8b13535216496fc4946888b9535d4f7d03f2 (diff)
downloadkrb5-c618db64af29b04b651cc8f354eec4ef7cbc5298.tar.gz
krb5-c618db64af29b04b651cc8f354eec4ef7cbc5298.tar.xz
krb5-c618db64af29b04b651cc8f354eec4ef7cbc5298.zip
ccdefault.c:
krb5_cc_default_name() is permitted to return a NULL pointer as a valid output. Passing a NULL pointer to strcmp() will result in an exception as NULL is not a valid input parameter to strcmp(). Save the output of krb5_cc_default_name() to a variable and modify the conditional to set the new default ccache name in the case where there is no existing default ccache name. ticket: 5080 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20551 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/ccache/ccdefault.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/krb5/ccache/ccdefault.c b/src/lib/krb5/ccache/ccdefault.c
index b7a592f74..c44a4771d 100644
--- a/src/lib/krb5/ccache/ccdefault.c
+++ b/src/lib/krb5/ccache/ccdefault.c
@@ -82,7 +82,8 @@ krb5int_cc_default(krb5_context context, krb5_ccache *ccache)
/* This function tries to get tickets and put them in the specified
cache, however, if the cache does not exist, it may choose to put
them elsewhere (ie: the system default) so we set that here */
- if (strcmp (krb5_cc_default_name (context), outCacheName) != 0) {
+ char * ccdefname = krb5_cc_default_name (context);
+ if (!ccdefname || strcmp (ccdefname, outCacheName) != 0) {
krb5_cc_set_default_name (context, outCacheName);
}
KLDisposeString (outCacheName);
@@ -102,7 +103,8 @@ krb5int_cc_default(krb5_context context, krb5_ccache *ccache)
char ccname[256]="";
pLeash_AcquireInitialTicketsIfNeeded(context, NULL, ccname, sizeof(ccname));
if (ccname[0]) {
- if (strcmp (krb5_cc_default_name (context),ccname) != 0) {
+ char * ccdefname = krb5_cc_default_name (context);
+ if (!ccdefname || strcmp (ccdefname, ccname) != 0) {
krb5_cc_set_default_name (context, ccname);
}
}