diff options
author | Greg Hudson <ghudson@mit.edu> | 2022-06-03 14:30:42 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2022-11-04 12:27:30 -0400 |
commit | 1166f1404c47af54f3d5b2533bb001fdadf6aadc (patch) | |
tree | af14cc7544d201880d581b36d8214150a433d035 /src/plugins | |
parent | 6401b303ad7bcd56228ba77fdcbea9625b168115 (diff) | |
download | krb5-1166f1404c47af54f3d5b2533bb001fdadf6aadc.zip krb5-1166f1404c47af54f3d5b2533bb001fdadf6aadc.tar.gz krb5-1166f1404c47af54f3d5b2533bb001fdadf6aadc.tar.bz2 |
Fix memory leak in OTP kdcpreauth module
In otp_edata(), free the generated nonce.
(cherry picked from commit 5ad465bc8e0d957a4945218bea487b77622bf433)
ticket: 9063
version_fixed: 1.20.1
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/preauth/otp/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/preauth/otp/main.c b/src/plugins/preauth/otp/main.c index 119714f..0e682aa 100644 --- a/src/plugins/preauth/otp/main.c +++ b/src/plugins/preauth/otp/main.c @@ -228,7 +228,7 @@ otp_edata(krb5_context context, krb5_kdc_req *request, krb5_pa_otp_challenge chl; krb5_pa_data *pa = NULL; krb5_error_code retval; - krb5_data *encoding; + krb5_data *encoding, nonce = empty_data(); char *config; /* Determine if otp is enabled for the user. */ @@ -256,9 +256,10 @@ otp_edata(krb5_context context, krb5_kdc_req *request, ti.iteration_count = -1; /* Generate the nonce. */ - retval = nonce_generate(context, armor_key->length, &chl.nonce); + retval = nonce_generate(context, armor_key->length, &nonce); if (retval != 0) goto out; + chl.nonce = nonce; /* Build the output pa-data. */ retval = encode_krb5_pa_otp_challenge(&chl, &encoding); @@ -275,6 +276,7 @@ otp_edata(krb5_context context, krb5_kdc_req *request, free(encoding); out: + krb5_free_data_contents(context, &nonce); (*respond)(arg, retval, pa); } |