kadmin: kadmind_dispatch do not write NULL 'rsp' to 'out'
commit124b8d0f7823663bec212ec3e8c049cfc391e3cd
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 21 Jan 2022 14:16:35 +0000 (21 09:16 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 21 Jan 2022 14:16:35 +0000 (21 09:16 -0500)
tree17b1f72e2194a65d68d852f2a40ab5f98b639baa
parent251cbf05c2abd1b46c2991d46f717944827467cb
kadmin: kadmind_dispatch do not write NULL 'rsp' to 'out'

1b213c1082be4ef5a1c23928d614c762f837dbe7 ("kadmind: Add missing
error checks") altered the behavior of kadmin_dispatch() such that
it unconditionally called

      krb5_storage_to_data(rsp, out);

This change was unsafe because krb5_unparse_name_fixed() failure
would skip the allocation of the 'rsp' and 'sp' krb5_storage
objects.

This change allocates the krb5_storage objects prior to performing
any work.  If either of them fail, kadmin_dispatch() immediately
returns ENOMEM.

Change-Id: I14fd96afe029a4e74bb769605286ca0e17d25043
kadmin/server.c