krb5 commit: Ensure defined behavior in k5_kt_have_match()

ghudson at mit.edu ghudson at mit.edu
Wed Oct 15 11:00:53 EDT 2025


https://github.com/krb5/krb5/commit/4e5d98464e83fd90faa55c2e11bec813a28c89ee
commit 4e5d98464e83fd90faa55c2e11bec813a28c89ee
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sun Oct 12 14:03:06 2025 -0400

    Ensure defined behavior in k5_kt_have_match()
    
    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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/krb5/keytab/ktfns.c b/src/lib/krb5/keytab/ktfns.c
index d6658b35f..f3945f9da 100644
--- a/src/lib/krb5/keytab/ktfns.c
+++ b/src/lib/krb5/keytab/ktfns.c
@@ -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);


More information about the cvs-krb5 mailing list