check return copy_Realm, copy_PrincipalName, copy_EncryptionKey

The ASN.1 functions copy_Realm(), copy_PrincipalName() and
copy_EncryptionKey() can fail.  Check the return and perform error
handling as appropriate.

Change-Id: I2b3629d19db96eb41d1cd554cef1dca99745e753
This commit is contained in:
Jeffrey Altman
2017-04-29 15:22:23 -04:00
parent cb1ab5b5fc
commit 6f3ab01c75
6 changed files with 53 additions and 17 deletions

View File

@@ -117,8 +117,12 @@ _krb5_build_authenticator (krb5_context context,
memset(&auth, 0, sizeof(auth));
auth.authenticator_vno = 5;
copy_Realm(&cred->client->realm, &auth.crealm);
copy_PrincipalName(&cred->client->name, &auth.cname);
ret = copy_Realm(&cred->client->realm, &auth.crealm);
if (ret)
goto fail;
ret = copy_PrincipalName(&cred->client->name, &auth.cname);
if (ret)
goto fail;
krb5_us_timeofday (context, &auth.ctime, &auth.cusec);