krb5 commit [krb5-1.19]: Fix memory leak in OTP kdcpreauth module
ghudson at mit.edu
ghudson at mit.edu
Tue Nov 15 11:30:41 EST 2022
https://github.com/krb5/krb5/commit/146e48e9a1b5ebdb30c0d57c3bd26170986371f1
commit 146e48e9a1b5ebdb30c0d57c3bd26170986371f1
Author: Greg Hudson <ghudson at mit.edu>
Date: Fri Jun 3 14:30:42 2022 -0400
Fix memory leak in OTP kdcpreauth module
In otp_edata(), free the generated nonce.
(cherry picked from commit 5ad465bc8e0d957a4945218bea487b77622bf433)
ticket: 9063
version_fixed: 1.19.4
src/plugins/preauth/otp/main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/plugins/preauth/otp/main.c b/src/plugins/preauth/otp/main.c
index a1b681682..2f3d7dfe2 100644
--- a/src/plugins/preauth/otp/main.c
+++ b/src/plugins/preauth/otp/main.c
@@ -211,7 +211,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. */
@@ -239,9 +239,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);
@@ -258,6 +259,7 @@ otp_edata(krb5_context context, krb5_kdc_req *request,
free(encoding);
out:
+ krb5_free_data_contents(context, &nonce);
(*respond)(arg, retval, pa);
}
More information about the cvs-krb5
mailing list