aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_user.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-08-11 17:45:46 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2017-08-11 17:49:38 +0200
commit3219e52dcf6e771bd03ad4abc3823422edb6e5fe (patch)
treeda5205333e3046a5acf56e305740438854096f42 /src/sccp_user.c
parentc34bcd42e494200a7057dadcfa7e34fdbe6c0fca (diff)
sccp: fixup for osmo_sccp_get_ss7()
osmo_sccp_get_ss7() has the risk of a nullpointer dereference, when sccp is NULL. Return NULL when the sccp instance is NULL. Add doxygen comment Change-Id: I84d484e4441fd37443fff8c67e17df8fb15d5b2e
Diffstat (limited to 'src/sccp_user.c')
-rw-r--r--src/sccp_user.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sccp_user.c b/src/sccp_user.c
index a4568cf..b0a807d 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -598,8 +598,13 @@ out_strings:
return NULL;
}
-struct osmo_ss7_instance *osmo_sccp_get_ss7(struct osmo_sccp_instance *sccp)
+/*! \brief get the SS7 instance that is related to the given SCCP instance
+ * \param[in] sccp SCCP instance
+ * \returns SS7 instance; NULL if sccp was NULL */
+struct osmo_ss7_instance *osmo_sccp_get_ss7(const struct osmo_sccp_instance *sccp)
{
+ if (!sccp)
+ return NULL;
return sccp->ss7;
}