]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Ensure null termination of AFS salts
authorGreg Hudson <ghudson@mit.edu>
Fri, 27 Apr 2012 17:04:24 +0000 (17:04 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 22 Apr 2013 22:29:57 +0000 (18:29 -0400)
Use krb5int_copy_data_contents_add0 when copying a pa-pw-salt or
pa-afs3-salt value in pa_salt().  If it's an afs3-salt, we're going to
throw away the length and use strcspn in krb5int_des_string_to_key,
which isn't safe if the value is unterminated.

(cherry picked from commit f566fee75f2455d6e5e7ee4fcdf5a0d327808639)

ticket: 7611 (new)
version_fixed: 1.9.5
status: resolved

src/lib/krb5/krb/preauth2.c

index f4896eb96a38607b2ae51a0f7d2432471273c4ad..4f582da9a26d1cb0fac0196a1e1cc88160ac1839 100644 (file)
@@ -608,7 +608,7 @@ pa_salt(krb5_context context, krb5_kdc_req *request, krb5_pa_data *in_padata,
 
     tmp = padata2data(*in_padata);
     krb5_free_data_contents(context, salt);
-    retval = krb5int_copy_data_contents(context, &tmp, salt);
+    retval = krb5int_copy_data_contents_add0(context, &tmp, salt);
     if (retval)
         return retval;