]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Improve negoex_parse_token() code hygiene 1082/head
authorRobbie Harwood <rharwood@redhat.com>
Tue, 9 Jun 2020 20:23:37 +0000 (16:23 -0400)
committerGreg Hudson <ghudson@mit.edu>
Sun, 14 Jun 2020 02:04:33 +0000 (22:04 -0400)
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@mit.edu: rewrote commit message]

src/lib/gssapi/spnego/negoex_util.c

index 7003684561b955ffbe5a4d73f508a2dbfc90ebf1..99580fd79cdf33fdf983cb3d12263709e96c6d40 100644 (file)
@@ -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;