From a6cb1d68383f20b7efe92ce9ad3841e4b306d61d Mon Sep 17 00:00:00 2001 From: Chris Provenzano Date: Tue, 25 Apr 1995 09:00:13 +0000 Subject: [PATCH] krb5_locate_kdc(): Pass a NUL terminated realm to profile_get_values() git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5478 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 5 +++++ src/lib/krb5/os/locate_kdc.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index e52844606..270a1e578 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +Tue Apr 25 04:50:13 1995 Chris Procenzano (proven@mit.edu) + + * locate_kdc.c (krb5_locate_kdc()): Pass a NUL terminated realm + to profile_get_values(). + Mon Apr 24 17:20:14 1995 Ezra Peisach * locate_kdc.c (krb5_locate_kdc): Don't deref NULL pointer diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index b13f65d1a..d5a280803 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -52,14 +52,21 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs) u_short sec_udpport = htons(KRB5_DEFAULT_SEC_PORT); #endif + if ((host = malloc(realm->length + 1)) == NULL) + return ENOMEM; + + strncpy(host, realm->data, realm->length); + host[realm->length] = '\0'; hostlist = 0; realm_kdc_names[0] = "realms"; - realm_kdc_names[1] = realm->data; + realm_kdc_names[1] = host; realm_kdc_names[2] = "kdc"; realm_kdc_names[3] = 0; code = profile_get_values(context->profile, realm_kdc_names, &hostlist); + krb5_xfree(host); + if (code == PROF_NO_SECTION) return KRB5_REALM_UNKNOWN; if (code == PROF_NO_RELATION) -- 2.26.2