From: Robbie Harwood Date: Tue, 9 Jun 2020 20:23:37 +0000 (-0400) Subject: Improve negoex_parse_token() code hygiene X-Git-Tag: krb5-1.19-beta1~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f91b6f8fa6fe1de662b3fdac0d59b7758ec642a;p=thirdparty%2Fkrb5.git 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@mit.edu: rewrote commit message] --- diff --git a/src/lib/gssapi/spnego/negoex_util.c b/src/lib/gssapi/spnego/negoex_util.c index 7003684561..99580fd79c 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;