From 39f24c4cd401cd39d0442d8da60f2166fa1b3dcd Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 26 May 2023 13:47:26 -0500 Subject: [PATCH] krb5: Fix crash in resolving "DIR" as a ccache name (Fix #1108) --- kuser/kinit.1 | 6 ++---- lib/krb5/dcache.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kuser/kinit.1 b/kuser/kinit.1 index dc1ab0365..f374a7c06 100644 --- a/kuser/kinit.1 +++ b/kuser/kinit.1 @@ -371,13 +371,11 @@ this is a FILE cache in a file named (the default would be .Ql /tmp/krb5cc_{UID} ) .It Ql FILE:/tmp/cc+jane@TEST.H5L.SE -.It Ql DIR: +.It Ql DIR:/tmp/ccdir this is a FILE cache named by .Ql /tmp/krb5cc_{UID}_dir/primary which will be of the form -.Ql /tmp/krb5cc_{UID}_dir/tkt.XXXXXX -.It Ql DIR:/tmp/ccdir -same, but in the givern directory rather than the default +.Ql /tmp/ccdir/tkt.XXXXXX .It Ql DIR:/tmp/ccdir:jane@TEST.H5L.SE this is a FILE ccache named .Ql /tmp/ccdir/tkt.jane@TEST.H5L.SE diff --git a/lib/krb5/dcache.c b/lib/krb5/dcache.c index 6a4a226a6..77ccda13e 100644 --- a/lib/krb5/dcache.c +++ b/lib/krb5/dcache.c @@ -377,7 +377,7 @@ dcc_resolve_2(krb5_context context, * */ - if (*res == '\0' || (res[0] == ':' && res[1] == '\0')) { + if (res == NULL || *res == '\0' || (res[0] == ':' && res[1] == '\0')) { /* XXX Why not? */ krb5_set_error_message(context, KRB5_CC_FORMAT, N_("\"DIR:\" is not a valid ccache name", ""));