Change in osmocom-bb[master]: host/layer23/ccch_scan: skip CCCH frames with wrong length

fixeria gerrit-no-reply at lists.osmocom.org
Thu Jun 10 11:50:14 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/24627 )

Change subject: host/layer23/ccch_scan: skip CCCH frames with wrong length
......................................................................

host/layer23/ccch_scan: skip CCCH frames with wrong length

It's not clear why do we get frames with unexpected length, but
we definitely should not crash.  Just log and ignore them.

Change-Id: I85392becbffdb3ba7365decfd8f3769abe3c02c7
Related: OS#5171
---
M src/host/layer23/src/misc/app_ccch_scan.c
1 file changed, 7 insertions(+), 0 deletions(-)

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



diff --git a/src/host/layer23/src/misc/app_ccch_scan.c b/src/host/layer23/src/misc/app_ccch_scan.c
index be2d9ae..e5a184f 100644
--- a/src/host/layer23/src/misc/app_ccch_scan.c
+++ b/src/host/layer23/src/misc/app_ccch_scan.c
@@ -409,6 +409,13 @@
 	struct gsm48_system_information_type_header *sih = msgb_l3(msg);
 	int rc = 0;
 
+	/* Skip frames with wrong length */
+	if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) {
+		LOGP(DRR, LOGL_ERROR, "Rx CCCH message with odd length=%u: %s\n",
+		     msgb_l3len(msg), msgb_hexdump_l3(msg));
+		return -EINVAL;
+	}
+
 	/* Skip dummy (fill) frames */
 	if (is_fill_frame(msg))
 		return 0;

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/24627
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I85392becbffdb3ba7365decfd8f3769abe3c02c7
Gerrit-Change-Number: 24627
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/d409f2d6/attachment.htm>


More information about the gerrit-log mailing list