From: Chris Provenzano Date: Tue, 25 Apr 1995 09:00:13 +0000 (+0000) Subject: krb5_locate_kdc(): Pass a NUL terminated realm to profile_get_values() X-Git-Tag: krb5-1.0-beta5~271 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a6cb1d68383f20b7efe92ce9ad3841e4b306d61d;p=krb5.git 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 --- 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)