mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Avoid passing non-terminated string to is_master_host
When string is not terminated, queries with corrupted base may be sent to LDAP: ... cn=ipa1.example.com<garbage>,cn=masters... https://fedorahosted.org/freeipa/ticket/4214 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
34c3d309d9
commit
740298d120
@ -488,13 +488,14 @@ static krb5_error_code ipadb_fill_info3(struct ipadb_context *ipactx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = krb5_princ_component(ipactx->context, princ, 1);
|
data = krb5_princ_component(ipactx->context, princ, 1);
|
||||||
strres = malloc(data->length);
|
strres = malloc(data->length+1);
|
||||||
if (strres == NULL) {
|
if (strres == NULL) {
|
||||||
krb5_free_principal(ipactx->kcontext, princ);
|
krb5_free_principal(ipactx->kcontext, princ);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(strres, data->data, data->length);
|
memcpy(strres, data->data, data->length);
|
||||||
|
strres[data->length] = '\0';
|
||||||
krb5_free_principal(ipactx->kcontext, princ);
|
krb5_free_principal(ipactx->kcontext, princ);
|
||||||
|
|
||||||
/* Only add PAC to TGT to services on IPA masters to allow querying
|
/* Only add PAC to TGT to services on IPA masters to allow querying
|
||||||
|
Loading…
Reference in New Issue
Block a user