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
b2cd24ed
Commit
b2cd24ed
authored
Jan 06, 2022
by
LoveSy
Committed by
John Wu
Jan 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an UB when cil compile error
parent
66cf2c98
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
rootdir.cpp
native/jni/init/rootdir.cpp
+5
-0
policydb.cpp
native/jni/magiskpolicy/policydb.cpp
+15
-1
No files found.
native/jni/init/rootdir.cpp
View file @
b2cd24ed
...
...
@@ -100,6 +100,11 @@ bool MagiskInit::patch_sepolicy(const char *file) {
if
(
patch_init
)
sepol
=
sepolicy
::
from_split
();
if
(
!
sepol
)
{
LOGE
(
"Cannot load split cil
\n
"
);
return
false
;
}
sepol
->
magisk_rules
();
// Custom rules
...
...
native/jni/magiskpolicy/policydb.cpp
View file @
b2cd24ed
...
...
@@ -107,6 +107,20 @@ sepolicy *sepolicy::compile_split() {
FILE
*
f
;
int
policy_ver
;
const
char
*
cil_file
;
#if MAGISK_DEBUG
cil_set_log_level
(
CIL_INFO
);
#endif
cil_set_log_handler
(
+
[](
int
lvl
,
char
*
msg
)
{
if
(
lvl
==
CIL_ERR
)
{
LOGE
(
"cil: %s"
,
msg
);
}
else
if
(
lvl
==
CIL_WARN
)
{
LOGW
(
"cil: %s"
,
msg
);
}
else
if
(
lvl
==
CIL_INFO
)
{
LOGI
(
"cil: %s"
,
msg
);
}
else
{
LOGD
(
"cil: %s"
,
msg
);
}
});
cil_db_init
(
&
db
);
run_finally
fin
([
db_ptr
=
&
db
]{
cil_db_destroy
(
db_ptr
);
});
...
...
@@ -114,7 +128,7 @@ sepolicy *sepolicy::compile_split() {
cil_set_multiple_decls
(
db
,
1
);
cil_set_disable_neverallow
(
db
,
1
);
cil_set_target_platform
(
db
,
SEPOL_TARGET_SELINUX
);
cil_set_attrs_expand_generated
(
db
,
0
);
cil_set_attrs_expand_generated
(
db
,
1
);
f
=
xfopen
(
SELINUX_VERSION
,
"re"
);
fscanf
(
f
,
"%d"
,
&
policy_ver
);
...
...
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