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
6935033d
Commit
6935033d
authored
Nov 12, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent dangling pointers
parent
421277d7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
hook.cpp
native/jni/zygisk/hook.cpp
+5
-0
No files found.
native/jni/zygisk/hook.cpp
View file @
6935033d
...
@@ -331,6 +331,11 @@ void ZygiskModule::setOption(zygisk::Option opt) {
...
@@ -331,6 +331,11 @@ void ZygiskModule::setOption(zygisk::Option opt) {
void
HookContext
::
run_modules_pre
(
const
vector
<
int
>
&
fds
)
{
void
HookContext
::
run_modules_pre
(
const
vector
<
int
>
&
fds
)
{
char
buf
[
256
];
char
buf
[
256
];
// Since we directly use the pointer to elements in the vector, in order to prevent dangling
// pointers, the vector has to be pre-allocated to ensure reallocation does not occur
modules
.
reserve
(
fds
.
size
());
for
(
int
i
=
0
;
i
<
fds
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
fds
.
size
();
++
i
)
{
snprintf
(
buf
,
sizeof
(
buf
),
"/proc/self/fd/%d"
,
fds
[
i
]);
snprintf
(
buf
,
sizeof
(
buf
),
"/proc/self/fd/%d"
,
fds
[
i
]);
if
(
void
*
h
=
dlopen
(
buf
,
RTLD_LAZY
))
{
if
(
void
*
h
=
dlopen
(
buf
,
RTLD_LAZY
))
{
...
...
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