sclc_rx_cldr(): Don't try to dereference user data_ie without check

While the SUA / SCCP2SUA code is ensuring that mandatory information
elements such as the user data IE in a CLD$ message, we might still have
current or future callers of sclc_rx_cldr() that don't comply with that.
So let's make sure data_ie is valid before dereferencing it.

Change-Id: I7c1010b0ac82ee0b7bd5e2c7413899695eae0070
Fixes: coverity CID#166940
This commit is contained in:
Harald Welte 2017-04-27 12:09:29 +02:00
parent 023d4f962b
commit 6fa1933178
1 changed files with 5 additions and 0 deletions

View File

@ -204,6 +204,11 @@ static int sclc_rx_cldr(struct osmo_sccp_instance *inst, struct xua_msg *xua)
struct msgb *upmsg = sccp_msgb_alloc(__func__);
struct osmo_sccp_user *scu;
if (!data_ie) {
LOGP(DLSCCP, LOGL_ERROR, "SCCP/SUA CLDR without user data?!?\n");
return -1;
}
/* fill primitive */
prim = (struct osmo_scu_prim *) msgb_put(upmsg, sizeof(*prim));
param = &prim->u.notice;