summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-06 11:45:38 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-06 11:45:38 +0200
commit1e61b256614ee58af46fa3a3ea2cba9c6d656018 (patch)
tree3746851ff5ebf0127fcd4c0fc56eb0c60656d176 /openbsc/src/libmsc/gsm_04_08.c
parent096dc3a466d41b294578b4aa0a48e621efc5bcec (diff)
mncc: Remove what we believe to be a tautology from the MNCC code
Coverity pointed out that we use trans->subscr after a NULL check, it is our believe that every transaction will have a subscriber. Remove the check and add an assert before we are dispatching things. Fixes: Coverity CID 1040740, CID 1040739
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_08.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index cd31f6974..b69ab953c 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -62,6 +62,8 @@
#include <osmocom/core/talloc.h>
#include <osmocom/gsm/tlv.h>
+#include <assert.h>
+
void *tall_locop_ctx;
void *tall_authciphop_ctx;
@@ -1758,13 +1760,12 @@ static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg)
setup.emergency = 1;
/* use subscriber as calling party number */
- if (trans->subscr) {
- setup.fields |= MNCC_F_CALLING;
- strncpy(setup.calling.number, trans->subscr->extension,
- sizeof(setup.calling.number)-1);
- strncpy(setup.imsi, trans->subscr->imsi,
- sizeof(setup.imsi)-1);
- }
+ setup.fields |= MNCC_F_CALLING;
+ strncpy(setup.calling.number, trans->subscr->extension,
+ sizeof(setup.calling.number)-1);
+ strncpy(setup.imsi, trans->subscr->imsi,
+ sizeof(setup.imsi)-1);
+
/* bearer capability */
if (TLVP_PRESENT(&tp, GSM48_IE_BEARER_CAP)) {
setup.fields |= MNCC_F_BEARER_CAP;
@@ -2087,13 +2088,12 @@ static int gsm48_cc_rx_connect(struct gsm_trans *trans, struct msgb *msg)
connect.callref = trans->callref;
tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0);
/* use subscriber as connected party number */
- if (trans->subscr) {
- connect.fields |= MNCC_F_CONNECTED;
- strncpy(connect.connected.number, trans->subscr->extension,
- sizeof(connect.connected.number)-1);
- strncpy(connect.imsi, trans->subscr->imsi,
- sizeof(connect.imsi)-1);
- }
+ connect.fields |= MNCC_F_CONNECTED;
+ strncpy(connect.connected.number, trans->subscr->extension,
+ sizeof(connect.connected.number)-1);
+ strncpy(connect.imsi, trans->subscr->imsi,
+ sizeof(connect.imsi)-1);
+
/* facility */
if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) {
connect.fields |= MNCC_F_FACILITY;
@@ -3182,6 +3182,8 @@ static int gsm0408_rcv_cc(struct gsm_subscriber_connection *conn, struct msgb *m
return 0;
}
+ assert(trans->subscr);
+
rc = datastatelist[i].rout(trans, msg);
return rc;