krb5 commit: Prevent KDC read overrun on empty service type
ghudson at mit.edu
ghudson at mit.edu
Fri Nov 20 03:03:17 EST 2026
https://github.com/krb5/krb5/commit/55aa29f03495fac22cc852e6004cdbf5ae7fdebd
commit 55aa29f03495fac22cc852e6004cdbf5ae7fdebd
Author: ubeddulla khan <ubed at bugqore.com>
Date: Thu Nov 19 00:35:30 2026 +0530
Prevent KDC read overrun on empty service type
In in_list(), return false for an empty item, to prevent the loop from
advancing past the end of list.
[ghudson at mit.edu: edited commit message and test case comment]
ticket: 9292 (new)
tags: pullup
target_version: 1.22-next
src/kdc/do_tgs_req.c | 2 +-
src/tests/t_referral.py | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c
index f74e0c5e7..9318397d8 100644
--- a/src/kdc/do_tgs_req.c
+++ b/src/kdc/do_tgs_req.c
@@ -420,7 +420,7 @@ in_list(const char *list, const char *item)
const char *p;
int len = strlen(item);
- if (list == NULL)
+ if (list == NULL || *item == '\0')
return FALSE;
for (p = strstr(list, item); p != NULL; p = strstr(p + 1, item)) {
if ((p == list || isspace((unsigned char)p[-1]) || p[-1] == ',') &&
diff --git a/src/tests/t_referral.py b/src/tests/t_referral.py
index f427d5b6e..18a3c5355 100755
--- a/src/tests/t_referral.py
+++ b/src/tests/t_referral.py
@@ -86,6 +86,12 @@ testfail(realm, 'srv-hst')
restart_kdc(realm, {'kdcdefaults': {'no_host_referral': 'b,c'}})
testref(realm, 'srv-hst')
+# Regression test for #9292: the KDC should not read past the end of
+# the config string if the service type is empty.
+shutil.copyfile(savefile, realm.ccache)
+realm.run(['./gcred', 'srv-hst', '/x.d@'], expected_code=1,
+ expected_msg='not found in Kerberos database')
+
# no_host_referrals should override host_based_services for NT-UNKNWON
# server names.
restart_kdc(realm, {'kdcdefaults': {'no_host_referral': '*',
More information about the cvs-krb5
mailing list