laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/29168 )

Change subject: SIGTRAN: error if attempting to send exceedingly big data
......................................................................

SIGTRAN: error if attempting to send exceedingly big data

Previously DT1 message sent via osmo_sccp_tx_data() was silently truncating 
data if it was over 256 bytes. Let's fail
explicitly and let caller handle this.

Related: OS#5579
Change-Id: I8a67bc40080eb1405ab3b0df874e3ea20941a850
---
M include/osmocom/sccp/sccp_types.h
M src/sccp_helpers.c
2 files changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/include/osmocom/sccp/sccp_types.h 
b/include/osmocom/sccp/sccp_types.h
index 94b8f0b..63ee568 100644
--- a/include/osmocom/sccp/sccp_types.h
+++ b/include/osmocom/sccp/sccp_types.h
@@ -25,6 +25,7 @@
 #include <osmocom/core/utils.h>

 #define SCCP_MAX_OPTIONAL_DATA 130
+#define SCCP_MAX_DATA 256

 /* Table 1/Q.713 - SCCP message types */
 enum sccp_message_types {
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 266c869..ae7c526 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -29,6 +29,7 @@
 #include <arpa/inet.h>
 #include <netinet/in.h>

+#include <osmocom/sccp/sccp_types.h>
 #include <osmocom/sigtran/sccp_sap.h>
 #include <osmocom/sigtran/sccp_helpers.h>

@@ -161,6 +162,12 @@
                return -ENOTCONN;
        }

+       if (len > SCCP_MAX_DATA) {
+               LOGP(DLSCCP, LOGL_ERROR, "N-DATA.req TX error: amount of data 
%u > %u - ITU-T Rec. Q.713 ยง4.7 limit\n",
+                        len, SCCP_MAX_DATA);
+               return -EMSGSIZE;
+       }
+
        msg = scu_msgb_alloc(__func__);
        prim = (struct osmo_scu_prim *) msgb_put(msg, sizeof(*prim));
        osmo_prim_init(&prim->oph, SCCP_SAP_USER,



2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/29168
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I8a67bc40080eb1405ab3b0df874e3ea20941a850
Gerrit-Change-Number: 29168
Gerrit-PatchSet: 3
Gerrit-Owner: msuraev <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to