aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-04-04 10:30:28 +0200
committerHarald Welte <laforge@gnumonks.org>2019-04-11 07:32:48 +0000
commit7231edb7321a238851387479df0ee16d6c936de0 (patch)
tree26b9a38ad1ba632e0738c53813225fa267046e64
parent5dede769e7288e04d8612f6e380ca297981471e1 (diff)
sgs_iface: fix nullpointer dereference
The function sgs_tx() is using the sgs connection pointer as context, even though it has done a check for a nullpointer in the line before. This is very prone to lead into a segfault when the SGs connection dies. Change-Id: I88b95e3f8cd35241ad68f08d94c6ad7067b842e6 Related: OS#3859
-rw-r--r--src/libmsc/sgs_iface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libmsc/sgs_iface.c b/src/libmsc/sgs_iface.c
index 450d552..f64b191 100644
--- a/src/libmsc/sgs_iface.c
+++ b/src/libmsc/sgs_iface.c
@@ -301,8 +301,8 @@ static void sgs_tx(struct sgs_connection *sgc, struct msgb *msg)
msgb_sctp_ppid(msg) = 0;
if (!sgc) {
- LOGSGC(sgc, LOGL_NOTICE, "Cannot transmit %s: connection dead. Discarding\n",
- sgsap_msg_type_name(msg->data[0]));
+ LOGP(LOGL_NOTICE, DSGS, "Cannot transmit %s: connection dead. Discarding\n",
+ sgsap_msg_type_name(msg->data[0]));
msgb_free(msg);
return;
}