krb5 commit: Improve negoex_parse_token() code hygiene

Greg Hudson ghudson at mit.edu
Sat Jun 13 23:05:46 EDT 2020


https://github.com/krb5/krb5/commit/4f91b6f8fa6fe1de662b3fdac0d59b7758ec642a
commit 4f91b6f8fa6fe1de662b3fdac0d59b7758ec642a
Author: Robbie Harwood <rharwood at redhat.com>
Date:   Tue Jun 9 16:23:37 2020 -0400

    Improve negoex_parse_token() code hygiene
    
    If the while loop in negoex_parse_token() runs for zero iterations,
    major will be used initialized.  Currently this cannot happen, but
    only because both of the call sites check for zero-length tokens.
    Initialize major for safety.
    
    [ghudson at mit.edu: rewrote commit message]

 src/lib/gssapi/spnego/negoex_util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lib/gssapi/spnego/negoex_util.c b/src/lib/gssapi/spnego/negoex_util.c
index 7003684..99580fd 100644
--- a/src/lib/gssapi/spnego/negoex_util.c
+++ b/src/lib/gssapi/spnego/negoex_util.c
@@ -454,7 +454,7 @@ negoex_parse_token(OM_uint32 *minor, spnego_gss_ctx_id_t ctx,
                    gss_const_buffer_t token,
                    struct negoex_message **messages_out, size_t *count_out)
 {
-    OM_uint32 major;
+    OM_uint32 major = GSS_S_COMPLETE;
     size_t count = 0;
     struct k5input in;
     struct negoex_message *messages = NULL, *newptr;


More information about the cvs-krb5 mailing list