mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 02:57:38 +00:00
Do not allow modifying page sizes
This commit is contained in:
parent
aebf2672cd
commit
9ea3169ca9
@ -94,7 +94,6 @@ void dyn_img_hdr::print() {
|
||||
|
||||
void dyn_img_hdr::dump_hdr_file() {
|
||||
FILE *fp = xfopen(HEADER_FILE, "w");
|
||||
fprintf(fp, "pagesize=%u\n", page_size());
|
||||
if (name())
|
||||
fprintf(fp, "name=%s\n", name());
|
||||
fprintf(fp, "cmdline=%.*s%.*s\n", BOOT_ARGS_SIZE, cmdline(), BOOT_EXTRA_ARGS_SIZE, extra_cmdline());
|
||||
@ -119,9 +118,7 @@ void dyn_img_hdr::dump_hdr_file() {
|
||||
|
||||
void dyn_img_hdr::load_hdr_file() {
|
||||
parse_prop_file(HEADER_FILE, [=](string_view key, string_view value) -> bool {
|
||||
if (key == "page_size") {
|
||||
page_size() = parse_int(value);
|
||||
} else if (key == "name" && name()) {
|
||||
if (key == "name" && name()) {
|
||||
memset(name(), 0, 16);
|
||||
memcpy(name(), value.data(), value.length() > 15 ? 15 : value.length());
|
||||
} else if (key == "cmdline") {
|
||||
|
@ -351,7 +351,7 @@ struct dyn_img_hdr {
|
||||
decl_var(kernel_size, 32)
|
||||
decl_var(ramdisk_size, 32)
|
||||
decl_var(second_size, 32)
|
||||
decl_var(page_size, 32)
|
||||
decl_val(page_size, uint32_t)
|
||||
decl_val(header_version, uint32_t)
|
||||
decl_var(extra_size, 32)
|
||||
decl_var(os_version, 32)
|
||||
@ -489,11 +489,8 @@ struct dyn_img_v3 : public dyn_img_hdr_boot {
|
||||
impl_val(cmdline)
|
||||
|
||||
// Make API compatible
|
||||
uint32_t &page_size() override { page_sz = 4096; return page_sz; }
|
||||
uint32_t page_size() override { return 4096; }
|
||||
char *extra_cmdline() override { return &v4_hdr->cmdline[BOOT_ARGS_SIZE]; }
|
||||
|
||||
private:
|
||||
uint32_t page_sz = 4096;
|
||||
};
|
||||
|
||||
struct dyn_img_v4 : public dyn_img_v3 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user