aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-06-02 09:33:31 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-06-02 09:46:32 +0200
commitf2e114ac85700c8b018d4d1495f6ef1762e0718d (patch)
tree7b7c6e83c5ca37791c79ec67a6513e728bf47a99
parent65b0efe56eafff992d60854787b83275ac33f84e (diff)
sgsn: seleted_apn_str might be NULL do not strcpy
The subscriber might simply not be allowed to use the APN that was specified. So selected_apn_str might very well be NULL. Fixes: Coverity CID#1302853
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index cc1ae4d25..f40de0b3c 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -709,7 +709,10 @@ struct sgsn_ggsn_ctx *sgsn_mm_ctx_find_ggsn_ctx(struct sgsn_mm_ctx *mmctx,
}
/* copy the selected apn_str */
- strcpy(out_apn_str, selected_apn_str);
+ if (selected_apn_str)
+ strcpy(out_apn_str, selected_apn_str);
+ else
+ out_apn_str[0] = '\0';
if (apn_ctx == NULL && selected_apn_str)
apn_ctx = sgsn_apn_ctx_match(selected_apn_str, mmctx->imsi);