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:26:54 UTC 2020


fixeria has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/88/16888/1

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-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200115/63d8373b/attachment.htm>


More information about the gerrit-log mailing list