smpp: Fix possible NULL dereference of the emse->acl
The esme->acl is treated like it can be NULL in other places
of the code. Assume it can be NULL during this check as well.
Dereference after null check (FORWARD_NULL)
9. var_deref_op: Dereferencing null pointer "esme->acl".
Fixes: Coverity CID 1042374
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index e41d377..f898cae 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -504,7 +504,7 @@
}
/* Transparently pass on DCS via SMPP if requested */
- if (esme->acl->dcs_transparent)
+ if (esme->acl && esme->acl->dcs_transparent)
deliver.data_coding = dcs;
if (mode == MODE_7BIT) {
@@ -530,7 +530,7 @@
memcpy(deliver.short_message, sms->user_data, deliver.sm_length);
}
- if (esme->acl->osmocom_ext && conn && conn->lchan)
+ if (esme->acl && esme->acl->osmocom_ext && conn && conn->lchan)
append_osmo_tlvs(&deliver.tlv, conn->lchan);
return smpp_tx_deliver(esme, &deliver);