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
4e2ecdb9
Unverified
Commit
4e2ecdb9
authored
Jun 17, 2022
by
LoveSy
Committed by
GitHub
Jun 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix env overflow
Fix #5989
parent
6e5df1f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
su_daemon.cpp
native/jni/su/su_daemon.cpp
+6
-7
No files found.
native/jni/su/su_daemon.cpp
View file @
4e2ecdb9
...
...
@@ -415,14 +415,13 @@ void su_daemon_handler(int client, const sock_cred *cred) {
if
(
realpath
(
path
,
cwd
))
chdir
(
cwd
);
snprintf
(
path
,
sizeof
(
path
),
"/proc/%d/environ"
,
ctx
.
pid
);
char
buf
[
4096
]
=
{
0
};
int
fd
=
xopen
(
path
,
O_RDONLY
);
read
(
fd
,
buf
,
sizeof
(
buf
));
close
(
fd
);
auto
env
=
full_read
(
path
);
clearenv
();
for
(
size_t
pos
=
0
;
buf
[
pos
];)
{
putenv
(
buf
+
pos
);
pos
+=
strlen
(
buf
+
pos
)
+
1
;
for
(
size_t
pos
=
0
;
pos
<
env
.
size
();
++
pos
)
{
putenv
(
env
.
data
()
+
pos
);
pos
=
env
.
find_first_of
(
'\0'
,
pos
);
if
(
pos
==
std
::
string
::
npos
)
break
;
}
if
(
!
ctx
.
req
.
keepenv
)
{
struct
passwd
*
pw
;
...
...
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