krb5_locate_kdc(): Pass a NUL terminated realm to profile_get_values()
authorChris Provenzano <proven@mit.edu>
Tue, 25 Apr 1995 09:00:13 +0000 (09:00 +0000)
committerChris Provenzano <proven@mit.edu>
Tue, 25 Apr 1995 09:00:13 +0000 (09:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5478 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/ChangeLog
src/lib/krb5/os/locate_kdc.c

index e528446063082382634609755f4e8204c7392bb7..270a1e578d28b5b290f5c54afb057a0ef9cfafc6 100644 (file)
@@ -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  <epeisach@kangaroo.mit.edu>
 
        * locate_kdc.c (krb5_locate_kdc): Don't deref NULL pointer
index b13f65d1ab4d0b6e3fdbec756de5a53607f64b48..d5a280803d9e4342a26571b9b0ca1f0b139a3af3 100644 (file)
@@ -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)