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)
This commit is contained in:
Pau Espin 2021-06-01 13:59:52 +02:00
parent 208c5b643f
commit 6c7ac6abcd
1 changed files with 4 additions and 0 deletions

View File

@ -166,6 +166,10 @@ int osmo_gsm48_range_enc_determine_range(const int *arfcns, const int size, int
{
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.
*/