lib/krb5: krb5_init_creds_set_service fail if set_realm fails
Calls to krb5_principal_set_realm() can fail due to memory allocation failures. If the client realm cannot be set in the generated principal the wrong realm will be used. Check for the result of krb5_principal_set_realm() and if there is a failure, clean up and return the error code to the caller. Change-Id: Icadd04c858e88c1ba1d4344c60a784885a6a1344
This commit is contained in:
@@ -2624,7 +2624,11 @@ krb5_init_creds_set_service(krb5_context context,
|
||||
ret = krb5_parse_name (context, service, &principal);
|
||||
if (ret)
|
||||
return ret;
|
||||
krb5_principal_set_realm (context, principal, client_realm);
|
||||
ret = krb5_principal_set_realm (context, principal, client_realm);
|
||||
if (ret) {
|
||||
krb5_free_principal(context, principal);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = krb5_make_principal(context, &principal,
|
||||
client_realm, KRB5_TGS_NAME, client_realm,
|
||||
|
Reference in New Issue
Block a user