krb5 commit: Fix SPAKE memory leak

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/91dad4eba37b5b56dc21d59880cb6eb4d3e6b7a5
commit 91dad4eba37b5b56dc21d59880cb6eb4d3e6b7a5
Author: Greg Hudson <[email protected]>
Date:   Tue Mar 27 10:36:05 2018 -0400

    Fix SPAKE memory leak
    
    In the NIST group implementations, ossl_fini() needs to free the
    groupdata container as well as its fields.  Also in
    spake_kdc.c:parse_data(), initialize the magic field of the resulting
    data object to avoid a harmless uninitialized memory copy.
    
    ticket: 8647

 src/plugins/preauth/spake/openssl.c   |    1 +
 src/plugins/preauth/spake/spake_kdc.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/plugins/preauth/spake/openssl.c b/src/plugins/preauth/spake/openssl.c
index b821a91..f2e4b53 100644
--- a/src/plugins/preauth/spake/openssl.c
+++ b/src/plugins/preauth/spake/openssl.c
@@ -69,6 +69,7 @@ ossl_fini(groupdata *gd)
     EC_POINT_free(gd->N);
     BN_CTX_free(gd->ctx);
     BN_free(gd->order);
+    free(gd);
 }
 
 static krb5_error_code
diff --git a/src/plugins/preauth/spake/spake_kdc.c b/src/plugins/preauth/spake/spake_kdc.c
index c1723eb..59e8840 100644
--- a/src/plugins/preauth/spake/spake_kdc.c
+++ b/src/plugins/preauth/spake/spake_kdc.c
@@ -75,6 +75,7 @@ parse_data(struct k5input *in, krb5_data *out)
 {
     out->length = k5_input_get_uint32_be(in);
     out->data = (char *)k5_input_get_bytes(in, out->length);
+    out->magic = KV5M_DATA;
 }
 
 /* Parse a received cookie into its components.  The pointers stored in the
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.