Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
2fef98a5
Commit
2fef98a5
authored
Oct 09, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wipe out prop_info data after delete
parent
36765cae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
prop_area.cpp
native/jni/external/systemproperties/prop_area.cpp
+23
-4
No files found.
native/jni/external/systemproperties/prop_area.cpp
View file @
2fef98a5
...
@@ -276,11 +276,11 @@ prop_bt* prop_area::find_prop_bt(prop_bt* const bt, const char* name, uint32_t n
...
@@ -276,11 +276,11 @@ prop_bt* prop_area::find_prop_bt(prop_bt* const bt, const char* name, uint32_t n
/* resetprop new: traverse through the trie and find the node.
/* resetprop new: traverse through the trie and find the node.
* This was originally part of prop_area::find_property. */
* This was originally part of prop_area::find_property. */
prop_bt
*
prop_area
::
find_prop_bt
(
prop_bt
*
const
trie
,
const
char
*
name
,
bool
alloc_if_needed
)
{
prop_bt
*
prop_area
::
find_prop_bt
(
prop_bt
*
const
bt
,
const
char
*
name
,
bool
alloc_if_needed
)
{
if
(
!
trie
)
return
nullptr
;
if
(
!
bt
)
return
nullptr
;
const
char
*
remaining_name
=
name
;
const
char
*
remaining_name
=
name
;
prop_bt
*
current
=
trie
;
prop_bt
*
current
=
bt
;
while
(
true
)
{
while
(
true
)
{
const
char
*
sep
=
strchr
(
remaining_name
,
'.'
);
const
char
*
sep
=
strchr
(
remaining_name
,
'.'
);
const
bool
want_subtree
=
(
sep
!=
nullptr
);
const
bool
want_subtree
=
(
sep
!=
nullptr
);
...
@@ -381,11 +381,30 @@ bool prop_area::add(const char* name, unsigned int namelen, const char* value,
...
@@ -381,11 +381,30 @@ bool prop_area::add(const char* name, unsigned int namelen, const char* value,
}
}
bool
prop_area
::
rm
(
const
char
*
name
)
{
bool
prop_area
::
rm
(
const
char
*
name
)
{
prop_bt
*
node
=
find_prop_bt
(
root_node
(),
name
,
false
);
prop_bt
*
node
=
find_prop_bt
(
root_node
(),
name
,
false
);
if
(
!
node
)
if
(
!
node
)
return
false
;
return
false
;
prop_info
*
info
=
nullptr
;
uint_least32_t
prop_offset
=
atomic_load_explicit
(
&
node
->
prop
,
memory_order_relaxed
);
if
(
prop_offset
!=
0
)
{
info
=
to_prop_info
(
&
node
->
prop
);
}
// De-reference the existing property ASAP
uint_least32_t
new_offset
=
0
;
uint_least32_t
new_offset
=
0
;
atomic_store_explicit
(
&
node
->
prop
,
new_offset
,
memory_order_release
);
atomic_store_explicit
(
&
node
->
prop
,
new_offset
,
memory_order_release
);
if
(
info
)
{
// Directly wipe out the old info
if
(
info
->
is_long
())
{
char
*
value
=
const_cast
<
char
*>
(
info
->
long_value
());
auto
len
=
strlen
(
value
);
memset
(
value
,
0
,
len
);
}
memset
(
info
,
0
,
sizeof
(
*
info
));
}
return
true
;
return
true
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment