1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-10 12:58:35 +03:00

s4:kdc: Check for overflow before calling smb_krb5_princ_component()

smb_krb5_princ_component() takes its component index parameter as ‘int’,
not ‘unsigned int’.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15482

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-09-21 12:01:27 +12:00 committed by Andrew Bartlett
parent 1221173577
commit ea6d2ddb66

View File

@ -912,6 +912,11 @@ static krb5_error_code principal_comp_strcmp_int(krb5_context context,
size_t len;
krb5_data d;
krb5_error_code ret = 0;
if (component > INT_MAX) {
return EINVAL;
}
if (component >= krb5_princ_size(context, principal)) {
/* A nonexistent component compares less than any string. */
*cmp = -1;