From 2585620857a3a6c17b17a65a3d9a863824b8e401 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 19 Jan 2015 09:13:05 +0100 Subject: sgsn: Fix access to subscr in sgsn_auth_update (Coverity) Currently the access to subscr->sgsn_data->error_cause is not protected against subscr == NULL like it is done in other code paths of sgsn_auth_update. This commit adds a conditional to avoid a NULL-dereference. Fixes: Coverity CID 1264589 Sponsored-by: On-Waves ehf --- openbsc/src/gprs/sgsn_auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbsc/src/gprs/sgsn_auth.c b/openbsc/src/gprs/sgsn_auth.c index 9f526dcc1..41f7c4157 100644 --- a/openbsc/src/gprs/sgsn_auth.c +++ b/openbsc/src/gprs/sgsn_auth.c @@ -257,7 +257,7 @@ void sgsn_auth_update(struct sgsn_mm_ctx *mmctx) gsm0408_gprs_access_granted(mmctx); break; case SGSN_AUTH_REJECTED: - gmm_cause = subscr->sgsn_data->error_cause; + gmm_cause = subscr ? subscr->sgsn_data->error_cause : 0; if (subscr && (subscr->flags & GPRS_SUBSCRIBER_CANCELLED) != 0) gsm0408_gprs_access_cancelled(mmctx, gmm_cause); -- cgit v1.2.3