summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntara Borwankar <antara.borwankar@intel.com>2019-12-19 18:27:49 +0530
committerDenis Kenzior <denkenz@gmail.com>2019-12-20 12:46:18 -0600
commitd90cfdd71cb9eb2b533a20e4aea6bbf79e79fd2e (patch)
treee0f97e2830c0625b17fad58665240470c698b964 /src
parentf76e1d75d05c216ff365505a30386afcc13545d8 (diff)
downloadofono-d90cfdd71cb9eb2b533a20e4aea6bbf79e79fd2e.tar.gz
sim: handling crash in error scenario for SIM PIN query
In case of error in sim_pin_query_cb function. pin_type is set to -1. This is causing segmentation fault in function sim_passwd_name due to invalid index pin_type = -1. Fixing this issue by handling error case before calling sim_passwd_name function.
Diffstat (limited to 'src')
-rw-r--r--src/sim.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sim.c b/src/sim.c
index 535ccbca..33e1245f 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -3201,7 +3201,7 @@ static void sim_pin_query_cb(const struct ofono_error *error,
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(sim->atom);
struct cached_pin *cpins = pin_cache_lookup(sim->iccid);
- const char *pin_name = sim_passwd_name(pin_type);
+ const char *pin_name;
char **locked_pins;
gboolean lock_changed;
@@ -3212,6 +3212,8 @@ static void sim_pin_query_cb(const struct ofono_error *error,
return;
}
+ pin_name = sim_passwd_name(pin_type);
+
if (sim->pin_type != pin_type) {
sim->pin_type = pin_type;