]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Ensure defined behavior in k5_kt_have_match() 1464/head
authorGreg Hudson <ghudson@mit.edu>
Sun, 12 Oct 2025 18:03:06 +0000 (14:03 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 15 Oct 2025 06:08:11 +0000 (02:08 -0400)
match_entries() in ktfns.c admits uninitialized use of match if the
loop runs for zero iterations (the keytab is valid but contains no
entries).  Initialize match to false to properly handle this case.
Fixes a -Werror compilation failure on macOS 10.6.8 reported by Sergey
Fedorov.

src/lib/krb5/keytab/ktfns.c

index d6658b35f2445faec314d544c77d2390369e18fe..f3945f9daf4c0929b3ae113334c8c36073ae2d2e 100644 (file)
@@ -138,7 +138,7 @@ match_entries(krb5_context context, krb5_keytab keytab,
     krb5_error_code ret;
     krb5_keytab_entry ent;
     krb5_kt_cursor cursor;
-    krb5_boolean match;
+    krb5_boolean match = FALSE;
 
     /* Scan the keytab for host-based entries matching accprinc. */
     ret = krb5_kt_start_seq_get(context, keytab, &cursor);