Review at  https://gerrit.osmocom.org/2292

(attempted) fix for SCCP CC without user data

Change-Id: If91edb526cbcd792ec5ebcb4518cf848feb69391
---
M src/sccp_scoc.c
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/92/2292/1

diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 2585c9f..b05e071 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -486,7 +486,7 @@
                if (conn->calling_addr.presence)
                        xua_msg_add_sccp_addr(xua, SUA_IEI_SRC_ADDR, 
&conn->calling_addr);
                /* optional: hop count; importance; priority; credit */
-               if (prim && msgb_l2(prim->oph.msg))
+               if (prim && msgb_l2(prim->oph.msg) && msgb_l2len(prim->oph.msg))
                        xua_msg_add_data(xua, SUA_IEI_DATA, 
msgb_l2len(prim->oph.msg),
                                         msgb_l2(prim->oph.msg));
                break;
@@ -506,7 +506,7 @@
                 * parameter */
                if (conn->calling_addr.presence)
                        xua_msg_add_sccp_addr(xua, SUA_IEI_DEST_ADDR, 
&conn->calling_addr);
-               if (prim && msgb_l2(prim->oph.msg))
+               if (prim && msgb_l2(prim->oph.msg) && msgb_l2len(prim->oph.msg))
                        xua_msg_add_data(xua, SUA_IEI_DATA, 
msgb_l2len(prim->oph.msg),
                                         msgb_l2(prim->oph.msg));
                break;
@@ -519,7 +519,7 @@
                xua_msg_add_u32(xua, SUA_IEI_SRC_REF, conn->conn_id);
                xua_msg_add_u32(xua, SUA_IEI_CAUSE, SUA_CAUSE_T_RELEASE | 
prim->u.disconnect.cause);
                /* optional: importance */
-               if (msgb_l2(prim->oph.msg))
+               if (prim && msgb_l2(prim->oph.msg) && msgb_l2len(prim->oph.msg))
                        xua_msg_add_data(xua, SUA_IEI_DATA, 
msgb_l2len(prim->oph.msg),
                                         msgb_l2(prim->oph.msg));
                break;
@@ -563,7 +563,7 @@
                        xua_msg_add_sccp_addr(xua, SUA_IEI_DEST_ADDR, 
&conn->calling_addr);
                /* optional: importance */
                /* optional: data */
-               if (prim && msgb_l2(prim->oph.msg))
+               if (prim && msgb_l2(prim->oph.msg) && msgb_l2len(prim->oph.msg))
                        xua_msg_add_data(xua, SUA_IEI_DATA, 
msgb_l2len(prim->oph.msg),
                                         msgb_l2(prim->oph.msg));
                break;

-- 
To view, visit https://gerrit.osmocom.org/2292
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If91edb526cbcd792ec5ebcb4518cf848feb69391
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to