Avoid segfaults if properties are not initialized
Null or constant dereferencing occurs if properties are not initialized. On Android devices it shouldn't happen but can be faced if testing bionic libc.so on Linux host. Change-Id: I8f047cbe17d0e7bcde40ace000a8aa53789c16cb Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
This commit is contained in:
parent
99b859cf78
commit
a21e696d90
|
@ -325,6 +325,8 @@ static void *to_prop_obj(prop_off_t off)
|
|||
{
|
||||
if (off > pa_data_size)
|
||||
return NULL;
|
||||
if (!__system_property_area__)
|
||||
return NULL;
|
||||
|
||||
return __system_property_area__->data + off;
|
||||
}
|
||||
|
@ -384,6 +386,8 @@ static const prop_info *find_property(prop_bt *trie, const char *name,
|
|||
{
|
||||
const char *remaining_name = name;
|
||||
|
||||
if (!trie) return NULL;
|
||||
|
||||
while (true) {
|
||||
char *sep = strchr(remaining_name, '.');
|
||||
bool want_subtree = (sep != NULL);
|
||||
|
|
Loading…
Reference in New Issue