diff options
author | Ezra Peisach <epeisach@mit.edu> | 2010-01-08 01:51:19 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 2010-01-08 01:51:19 +0000 |
commit | b10e3f1d00cf2a4e7f8e11180cba75e1ea49e362 (patch) | |
tree | ad06086517b041a613b0f33343f58028cf273585 /src/lib/crypto/krb | |
parent | 9f4eacfe818bff7e0d8c2c14f713aa28f06420e4 (diff) | |
download | krb5-b10e3f1d00cf2a4e7f8e11180cba75e1ea49e362.tar.gz krb5-b10e3f1d00cf2a4e7f8e11180cba75e1ea49e362.tar.xz krb5-b10e3f1d00cf2a4e7f8e11180cba75e1ea49e362.zip |
krb5int_derive_key results in cache with uninitialized values
krb5int_derive_key creates a temporary keyblock to add to the derived cache.
krb5_k_free_key will iterate over the derived keys and for ones with cache will
lookup the enctype for the key_cleanup handler.
Unfortunatly, there isn't a keyblock init function that does not allocate the
keyblock - as I suspect this problem will appear in other places.
The valgrind log of this problem is:
==7281== Conditional jump or move depends on uninitialised value(s)
==7281== at 0x40E9AE8: find_enctype (etypes.h:81)
==7281== by 0x40E9C96: krb5_k_free_key (key.c:91)
==7281== by 0x40E9C52: krb5_k_free_key (key.c:86)
==7281== by 0x40EBB00: krb5_c_prf (prf.c:87)
==7281== by 0x40E7B1B: prf_plus (cf2.c:77)
==7281== by 0x40E7CE6: krb5_c_fx_cf2_simple (cf2.c:125)
==7281== by 0x804899C: main (t_cf2.c:70)
==7281==
with memory leaks.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23608 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/krb')
-rw-r--r-- | src/lib/crypto/krb/dk/derive.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/crypto/krb/dk/derive.c b/src/lib/crypto/krb/dk/derive.c index 384a5e400..5fd887647 100644 --- a/src/lib/crypto/krb/dk/derive.c +++ b/src/lib/crypto/krb/dk/derive.c @@ -183,6 +183,10 @@ krb5int_derive_key(const struct krb5_enc_provider *enc, /* Derive into a temporary keyblock. */ keyblock.length = enc->keylength; keyblock.contents = malloc(keyblock.length); + /* Set the enctype as the krb5_k_free_key will iterate over list + or derived keys and invoke krb5_k_free_key which will lookup + the enctype for key_cleanup handler */ + keyblock.enctype = inkey->keyblock.enctype; if (keyblock.contents == NULL) return ENOMEM; ret = krb5int_derive_keyblock(enc, inkey, &keyblock, in_constant); |