Check _kdc_db_fetch return value before dereference entry pointer

This fixes a segfault if the _kdc_db_fetch function does not find
the entry in the database (the entry pointer will be NULL if entry
is not found).

Signed-off-by: Samuel Cabrero <scabrero@zentyal.com>
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
This commit is contained in:
Samuel Cabrero
2014-07-18 15:13:19 +02:00
committed by Love Hörnquist Åstrand
parent c93db5aa52
commit f79326e960

View File

@@ -1211,7 +1211,6 @@ tgs_parse_request(krb5_context context,
krbtgt_kvno = ap_req.ticket.enc_part.kvno ? *ap_req.ticket.enc_part.kvno : 0;
ret = _kdc_db_fetch(context, config, princ, HDB_F_GET_KRBTGT,
&krbtgt_kvno, NULL, krbtgt);
krbtgt_kvno_try = krbtgt_kvno ? krbtgt_kvno : (*krbtgt)->entry.kvno;
if (ret == HDB_ERR_NOT_FOUND_HERE) {
/* XXX Factor out this unparsing of the same princ all over */
@@ -1269,6 +1268,7 @@ tgs_parse_request(krb5_context context,
goto out;
}
krbtgt_kvno_try = krbtgt_kvno ? krbtgt_kvno : (*krbtgt)->entry.kvno;
*krbtgt_etype = ap_req.ticket.enc_part.etype;
next_kvno: