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
This commit is contained in:
Holger Hans Peter Freyther 2015-06-02 09:33:31 +02:00
parent 65b0efe56e
commit f2e114ac85
1 changed files with 4 additions and 1 deletions

View File

@ -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);