aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-10-21 11:10:23 +0200
committerHarald Welte <laforge@gnumonks.org>2018-10-21 11:10:23 +0200
commitd4c391eab03ce768d7eaf483368d9cda4f9668df (patch)
tree822feccddbdaf13a488c5d50021e4140c103d34f
parent7656f5f90adfe0b28ab1553923a8fed6ab1c53aa (diff)
range_enc_determine_range(): Don't dereference array on size=0
Change-Id: I5bbb10af8b8e8ebc22bf79f5468e71a41b5e74b3 Fixes: Coverity CID#182710
-rw-r--r--src/osmo-bsc/arfcn_range_encode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/osmo-bsc/arfcn_range_encode.c b/src/osmo-bsc/arfcn_range_encode.c
index 84f9f635f..54d98a967 100644
--- a/src/osmo-bsc/arfcn_range_encode.c
+++ b/src/osmo-bsc/arfcn_range_encode.c
@@ -168,6 +168,10 @@ int range_enc_determine_range(const int *arfcns, const int size, int *f0)
{
int max = 0;
+ /* don't dereference arfcns[] array if size is 0 */
+ if (size == 0)
+ return ARFCN_RANGE_128;
+
/*
* Go for the easiest. And pick arfcns[0] == f0.
*/