krb5 commit: Initialize some data structure magic fields

Greg Hudson ghudson at mit.edu
Sat May 4 00:31:59 EDT 2019


https://github.com/krb5/krb5/commit/551e88e76e537e45f6c80eadaefeb790994f83f9
commit 551e88e76e537e45f6c80eadaefeb790994f83f9
Author: Robbie Harwood <rharwood at redhat.com>
Date:   Thu May 2 13:36:38 2019 -0400

    Initialize some data structure magic fields
    
    Static analyzers may complain if they see a data structure copied with
    an uninitialized field, even if the copy target won't use the field.
    Add magic field initializers in three such places.
    
    [ghudson at mit.edu: rewrote commit message]

 src/lib/gssapi/krb5/util_cksum.c |    1 +
 src/lib/krb5/krb/authdata.c      |    8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/lib/gssapi/krb5/util_cksum.c b/src/lib/gssapi/krb5/util_cksum.c
index cfd585e..a177077 100644
--- a/src/lib/gssapi/krb5/util_cksum.c
+++ b/src/lib/gssapi/krb5/util_cksum.c
@@ -48,6 +48,7 @@ kg_checksum_channel_bindings(context, cb, cksum)
 
     cksum->checksum_type = CKSUMTYPE_RSA_MD5;
     cksum->length = sumlen;
+    cksum->magic = KV5M_CHECKSUM;
 
     /* generate a buffer full of zeros if no cb specified */
 
diff --git a/src/lib/krb5/krb/authdata.c b/src/lib/krb5/krb/authdata.c
index 7fbcfab..3e7dfbe 100644
--- a/src/lib/krb5/krb/authdata.c
+++ b/src/lib/krb5/krb/authdata.c
@@ -976,9 +976,7 @@ krb5_authdata_export_internal(krb5_context kcontext,
 
     *ptr = NULL;
 
-    name.length = strlen(module_name);
-    name.data = (char *)module_name;
-
+    name = make_data((char *)module_name, strlen(module_name));
     module = k5_ad_find_module(kcontext, context, AD_USAGE_MASK, &name);
     if (module == NULL)
         return ENOENT;
@@ -1005,9 +1003,7 @@ krb5_authdata_free_internal(krb5_context kcontext,
     krb5_data name;
     struct _krb5_authdata_context_module *module;
 
-    name.length = strlen(module_name);
-    name.data = (char *)module_name;
-
+    name = make_data((char *)module_name, strlen(module_name));
     module = k5_ad_find_module(kcontext, context, AD_USAGE_MASK, &name);
     if (module == NULL)
         return ENOENT;


More information about the cvs-krb5 mailing list