sim: validate IMS private identity

Make sure that IMS private identity is a valid UTF8 string before
setting sim->impi field. Otherwise ofono may crash on dbus assert
when SIM properties are reported via org.ofono.SimManager interface.
This commit is contained in:
Sergey Matyukevich 2021-01-16 22:21:06 +03:00 committed by Denis Kenzior
parent bae8ebe907
commit 7a62b554ab
1 changed files with 2 additions and 1 deletions

View File

@ -1664,7 +1664,8 @@ static void impi_read_cb(int ok, int total_length, int record,
return; return;
} }
sim->impi = g_strndup((const char *)data + 2, data[1]); if (validate_utf8_tlv(data))
sim->impi = g_strndup((const char *)data + 2, data[1]);
} }
static void discover_apps_cb(const struct ofono_error *error, static void discover_apps_cb(const struct ofono_error *error,