krb5 commit: Fix minor leak in kadmind password change dispatch

Greg Hudson ghudson at mit.edu
Fri Oct 26 10:42:08 EDT 2018


https://github.com/krb5/krb5/commit/597f18953367bbc246fbb0222355a7a94ffff6b4
commit 597f18953367bbc246fbb0222355a7a94ffff6b4
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Oct 25 12:21:45 2018 -0400

    Fix minor leak in kadmind password change dispatch
    
    In the unlikely event that kadmind cannot resolve the KDB keytab in
    schpw.c:dispatch(), don't leak the error message.  Reported by Bean
    Zhang.

 src/kadmin/server/schpw.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/kadmin/server/schpw.c b/src/kadmin/server/schpw.c
index 491cba9..f7dea39 100644
--- a/src/kadmin/server/schpw.c
+++ b/src/kadmin/server/schpw.c
@@ -438,11 +438,14 @@ dispatch(void *handle, const krb5_fulladdr *local_addr,
     krb5_keytab kt = NULL;
     kadm5_server_handle_t server_handle = (kadm5_server_handle_t)handle;
     krb5_data *response = NULL;
+    const char *emsg;
 
     ret = krb5_kt_resolve(server_handle->context, "KDB:", &kt);
     if (ret != 0) {
+        emsg = krb5_get_error_message(server_handle->context, ret);
         krb5_klog_syslog(LOG_ERR, _("chpw: Couldn't open admin keytab %s"),
-                         krb5_get_error_message(server_handle->context, ret));
+                         emsg);
+        krb5_free_error_message(server_handle->context, emsg);
         goto egress;
     }
 


More information about the cvs-krb5 mailing list