[PATCH] openbsc[master]: Prevent segfault in range encoding

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/.

Max gerrit-no-reply at lists.osmocom.org
Wed Dec 14 13:54:51 UTC 2016


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

Prevent segfault in range encoding

Explicitly check when ARFCN array split is impossible and return
gracefully instead of using negative index.

Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0
Related: RT#7379
---
M openbsc/src/libbsc/arfcn_range_encode.c
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/29/1429/1

diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c
index dce864d..8260593 100644
--- a/openbsc/src/libbsc/arfcn_range_encode.c
+++ b/openbsc/src/libbsc/arfcn_range_encode.c
@@ -109,6 +109,8 @@
 
 	/* Now do the processing */
 	split_at = range_enc_find_index(range, arfcns, size);
+	if (split_at < 0)
+		return;
 
 	/* we now know where to split */
 	out[index] = 1 + arfcns[split_at];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list