Use buffer on stack
This commit is contained in:
parent
252afe8932
commit
46aad00f16
@ -22,7 +22,7 @@
|
|||||||
#include "resetprop.h"
|
#include "resetprop.h"
|
||||||
#include "magiskpolicy.h"
|
#include "magiskpolicy.h"
|
||||||
|
|
||||||
static char *buf, *buf2;
|
static char buf[PATH_MAX], buf2[PATH_MAX];
|
||||||
static struct vector module_list;
|
static struct vector module_list;
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
@ -118,7 +118,6 @@ static void set_path(struct vector *v) {
|
|||||||
char buffer[512];
|
char buffer[512];
|
||||||
for (int i = 0; environ[i]; ++i) {
|
for (int i = 0; environ[i]; ++i) {
|
||||||
if (strncmp(environ[i], "PATH=", 5) == 0) {
|
if (strncmp(environ[i], "PATH=", 5) == 0) {
|
||||||
// Prepend BBPATH to PATH
|
|
||||||
sprintf(buffer, "PATH="BBPATH":%s", environ[i] + 5);
|
sprintf(buffer, "PATH="BBPATH":%s", environ[i] + 5);
|
||||||
vec_push_back(v, strdup(buffer));
|
vec_push_back(v, strdup(buffer));
|
||||||
} else {
|
} else {
|
||||||
@ -532,10 +531,6 @@ void startup() {
|
|||||||
|
|
||||||
// No uninstaller or core-only mode
|
// No uninstaller or core-only mode
|
||||||
if (access(DISABLEFILE, F_OK) != 0) {
|
if (access(DISABLEFILE, F_OK) != 0) {
|
||||||
// Allocate buffer
|
|
||||||
buf = xmalloc(PATH_MAX);
|
|
||||||
buf2 = xmalloc(PATH_MAX);
|
|
||||||
|
|
||||||
simple_mount("/system");
|
simple_mount("/system");
|
||||||
simple_mount("/vendor");
|
simple_mount("/vendor");
|
||||||
}
|
}
|
||||||
@ -549,7 +544,6 @@ void startup() {
|
|||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
int root, sbin, fd;
|
int root, sbin, fd;
|
||||||
char buf[PATH_MAX];
|
|
||||||
void *magisk, *init;
|
void *magisk, *init;
|
||||||
size_t magisk_size, init_size;
|
size_t magisk_size, init_size;
|
||||||
|
|
||||||
@ -717,8 +711,6 @@ void post_fs_data(int client) {
|
|||||||
"/sbin/magiskpolicy", "--save", TMPSEPOLICY, "allow "SEPOL_PROC_DOMAIN" * * *", NULL);
|
"/sbin/magiskpolicy", "--save", TMPSEPOLICY, "allow "SEPOL_PROC_DOMAIN" * * *", NULL);
|
||||||
|
|
||||||
// Allocate buffer
|
// Allocate buffer
|
||||||
buf = xmalloc(PATH_MAX);
|
|
||||||
buf2 = xmalloc(PATH_MAX);
|
|
||||||
vec_init(&module_list);
|
vec_init(&module_list);
|
||||||
|
|
||||||
// Merge, trim, mount magisk.img, which will also travel through the modules
|
// Merge, trim, mount magisk.img, which will also travel through the modules
|
||||||
@ -835,10 +827,6 @@ void late_start(int client) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate buffer
|
|
||||||
if (buf == NULL) buf = xmalloc(PATH_MAX);
|
|
||||||
if (buf2 == NULL) buf2 = xmalloc(PATH_MAX);
|
|
||||||
|
|
||||||
auto_start_magiskhide();
|
auto_start_magiskhide();
|
||||||
|
|
||||||
if (full_patch_pid > 0) {
|
if (full_patch_pid > 0) {
|
||||||
@ -878,9 +866,6 @@ core_only:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All boot stage done, cleanup everything
|
// All boot stage done, cleanup
|
||||||
free(buf);
|
|
||||||
free(buf2);
|
|
||||||
buf = buf2 = NULL;
|
|
||||||
vec_deep_destroy(&module_list);
|
vec_deep_destroy(&module_list);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user