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
84ffdf0e
Commit
84ffdf0e
authored
Dec 24, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate a possbility to cause segfault
parent
022b18c8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
vector.h
core/jni/include/vector.h
+1
-1
dtb.c
core/jni/magiskboot/dtb.c
+2
-3
cpio.c
core/jni/utils/cpio.c
+1
-1
No files found.
core/jni/include/vector.h
View file @
84ffdf0e
...
...
@@ -29,7 +29,7 @@ struct vector *vec_dup(struct vector *v);
for (int _ = 0; v && _ < (v)->size; ++_, e = (v)->data[_])
#define vec_for_each_r(v, e) \
e =
v
? (v)->data[(v)->size - 1] : NULL; \
e =
(v && (v)->size > 0)
? (v)->data[(v)->size - 1] : NULL; \
for (int _ = ((int) (v)->size) - 1; v && _ >= 0; --_, e = (v)->data[_])
#define vec_cur(v) vec_entry(v)[_]
...
...
core/jni/magiskboot/dtb.c
View file @
84ffdf0e
...
...
@@ -49,7 +49,7 @@ static void dtb_dump(const char *file) {
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
if
(
memcmp
(
dtb
+
i
,
DTB_MAGIC
,
4
)
==
0
)
{
fdt
=
dtb
+
i
;
fprintf
(
stderr
,
"Dumping dtb.%04d
\n
\n
"
,
dtb_num
++
);
fprintf
(
stderr
,
"Dumping dtb.%04d
\n
"
,
dtb_num
++
);
print_subnode
(
fdt
,
0
,
0
);
}
}
...
...
@@ -61,7 +61,7 @@ static void dtb_dump(const char *file) {
static
void
dtb_patch
(
const
char
*
file
,
int
patch
)
{
size_t
size
;
void
*
dtb
,
*
fdt
;
fprintf
(
stderr
,
"Loading dtbs from [%s]
\n
\n
"
,
file
);
fprintf
(
stderr
,
"Loading dtbs from [%s]
\n
"
,
file
);
if
(
patch
)
mmap_rw
(
file
,
&
dtb
,
&
size
);
else
...
...
@@ -84,7 +84,6 @@ static void dtb_patch(const char *file, int patch) {
}
}
}
fprintf
(
stderr
,
"
\n
"
);
munmap
(
dtb
,
size
);
exit
(
!
found
);
}
...
...
core/jni/utils/cpio.c
View file @
84ffdf0e
...
...
@@ -57,9 +57,9 @@ void cpio_vec_insert(struct vector *v, cpio_entry *n) {
// Parse cpio file to a vector of cpio_entry
void
parse_cpio
(
struct
vector
*
v
,
const
char
*
filename
)
{
fprintf
(
stderr
,
"Loading cpio: [%s]
\n
"
,
filename
);
int
fd
=
open
(
filename
,
O_RDONLY
);
if
(
fd
<
0
)
return
;
fprintf
(
stderr
,
"Loading cpio: [%s]
\n
"
,
filename
);
cpio_newc_header
header
;
cpio_entry
*
f
;
while
(
xxread
(
fd
,
&
header
,
110
)
!=
-
1
)
{
...
...
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