Change in osmo-pcu[master]: pcu_l1_if.cpp: fix NULL-pointer dereference in imsi2paging_group()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jan 15 17:31:09 UTC 2020


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/16888 )

Change subject: pcu_l1_if.cpp: fix NULL-pointer dereference in imsi2paging_group()
......................................................................

pcu_l1_if.cpp: fix NULL-pointer dereference in imsi2paging_group()

Passing NULL to strlen() would lead to a segmentation fault.

Change-Id: I838e3a21a3b25c2bc8260f67d156c6cc284f4456
Fixes: CID#207484
---
M src/pcu_l1_if.cpp
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 1f23c25..98b8028 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -66,9 +66,10 @@
 uint16_t imsi2paging_group(const char* imsi)
 {
 	uint16_t pgroup = 0;
-	size_t len = strlen(imsi);
+	size_t len;
 
-	if (!imsi || len < PAGING_GROUP_LEN)
+	len = (imsi != NULL) ? strlen(imsi) : 0;
+	if (len < PAGING_GROUP_LEN)
 		return 0xFFFF;
 	imsi += len - PAGING_GROUP_LEN;
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I838e3a21a3b25c2bc8260f67d156c6cc284f4456
Gerrit-Change-Number: 16888
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
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/20200115/5c4f24ba/attachment.htm>


More information about the gerrit-log mailing list