ofono: Check for mcc before using it as an index
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 10 Feb 2012 14:53:29 +0000 (15:53 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 10 Feb 2012 14:54:14 +0000 (15:54 +0100)
Also avoid calling set_regdom is the alpha2 is NULL.

plugins/ofono.c

index 0a77a6f..df2b580 100644 (file)
@@ -1415,11 +1415,12 @@ static void netreg_update_regdom(struct modem_data *modem,
 
 
        mcc = atoi(mobile_country_code);
-       if (mcc > 799)
+       if (mcc > 799 || mcc < 200)
                return;
 
        alpha2 = mcc_country_codes[mcc - 200];
-       connman_technology_set_regdom(alpha2);
+       if (alpha2 != NULL)
+               connman_technology_set_regdom(alpha2);
 }
 
 static gboolean netreg_changed(DBusConnection *connection, DBusMessage *message,