From 0f05d25ddecba6d8dd5de5c1b2e31f45942b9a85 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 2 May 2019 13:36:38 -0400 Subject: [PATCH] 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@mit.edu: rewrote commit message] (cherry picked from commit 551e88e76e537e45f6c80eadaefeb790994f83f9) --- 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 cfd585ec7..a1770774e 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 7fbcfab68..3e7dfbe49 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;