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
This commit is contained in:
Philipp Maier 2019-04-04 10:30:28 +02:00 committed by Harald Welte
parent 5dede769e7
commit 7231edb732
1 changed files with 2 additions and 2 deletions

View File

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