krb5: Fix NULL-deref in send_to_kdc

Coverity thinks `handle` in lib/krb5/send_to_kdc.c:krb5_sendto_context()
at 1241 can be NULL, leading to a NULL derefence in `get_next()`.  This
is an attempt to fix this by having `get_next()` check handle for NULL.
This commit is contained in:
Nicolas Williams
2022-01-17 11:16:07 -06:00
parent 04b07ff8b6
commit fc42ff0212

View File

@@ -438,7 +438,7 @@ krb5_krbhst_get_addrinfo(krb5_context context, krb5_krbhst_info *host,
static krb5_boolean
get_next(struct krb5_krbhst_data *kd, krb5_krbhst_info **host)
{
struct krb5_krbhst_info *hi = *kd->index;
struct krb5_krbhst_info *hi = kd ? *kd->index : NULL;
if(hi != NULL) {
*host = hi;
kd->index = &(*kd->index)->next;