mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
(blind) fix off-by-one bug (ITS#6223; fixed differently)
This commit is contained in:
parent
a9990e8914
commit
a94b978e9d
1 changed files with 5 additions and 5 deletions
|
|
@ -542,12 +542,12 @@ guess_service_principal(
|
|||
|
||||
} else if (allow_remote && dnsHostName) {
|
||||
principal_fmt = "ldap/%s";
|
||||
svc_principal_size = strlen(dnsHostName) + strlen(principal_fmt);
|
||||
svc_principal_size = STRLENOF("ldap/") + strlen(dnsHostName) + 1;
|
||||
str = dnsHostName;
|
||||
|
||||
} else {
|
||||
principal_fmt = "ldap/%s";
|
||||
svc_principal_size = strlen(host) + strlen(principal_fmt);
|
||||
svc_principal_size = STRLENOF("ldap/") + strlen(host) + 1;
|
||||
str = host;
|
||||
}
|
||||
|
||||
|
|
@ -557,8 +557,8 @@ guess_service_principal(
|
|||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
ret = snprintf( svc_principal, svc_principal_size - 1, principal_fmt, str);
|
||||
if (ret < 0 || (size_t)ret + 1 >= svc_principal_size) {
|
||||
ret = snprintf( svc_principal, svc_principal_size, principal_fmt, str );
|
||||
if (ret < 0 || (size_t)ret >= svc_principal_size) {
|
||||
ld->ld_errno = LDAP_LOCAL_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
|
@ -567,7 +567,7 @@ guess_service_principal(
|
|||
host, svc_principal, 0 );
|
||||
|
||||
input_name.value = svc_principal;
|
||||
input_name.length = strlen( svc_principal );
|
||||
input_name.length = (size_t)ret;
|
||||
|
||||
gss_rc = gss_import_name( &minor_status, &input_name, &nt_principal, principal );
|
||||
ldap_memfree( svc_principal );
|
||||
|
|
|
|||
Loading…
Reference in a new issue