Change in libosmocore[master]: range_enc_determine_range(): Don't dereference array on size=0

pespin gerrit-no-reply at lists.osmocom.org
Tue Jun 1 16:23:39 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24496 )

Change subject: range_enc_determine_range(): Don't dereference array on size=0
......................................................................

range_enc_determine_range(): Don't dereference array on size=0

cherry-picked from osmo-bsc.git d4c391eab03ce768d7eaf483368d9cda4f9668df

Change-Id: Iae058c35506bc25c9f4790889b89ac46aea664b6
Fixes: Coverity CID#182710 (osmo-bsc.git)
---
M src/gsm/gsm48_arfcn_range_encode.c
1 file changed, 4 insertions(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm48_arfcn_range_encode.c b/src/gsm/gsm48_arfcn_range_encode.c
index 6423a9a..afe552d 100644
--- a/src/gsm/gsm48_arfcn_range_encode.c
+++ b/src/gsm/gsm48_arfcn_range_encode.c
@@ -166,6 +166,10 @@
 {
 	int max = 0;
 
+	/* don't dereference arfcns[] array if size is 0 */
+	if (size == 0)
+		return OSMO_GSM48_ARFCN_RANGE_128;
+
 	/*
 	 * Go for the easiest. And pick arfcns[0] == f0.
 	 */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iae058c35506bc25c9f4790889b89ac46aea664b6
Gerrit-Change-Number: 24496
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
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/20210601/5e9e0d9d/attachment.htm>


More information about the gerrit-log mailing list