fix(spoofer): redirect to .proc & add it to .gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
build/
|
build/
|
||||||
.env
|
.env
|
||||||
|
.proc/
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ FILE *fopen(const char *path, const char *mode) {
|
|||||||
|
|
||||||
if (path && strncmp(path, "/proc/", 6) == 0) {
|
if (path && strncmp(path, "/proc/", 6) == 0) {
|
||||||
const char *rel_suffix = path + 1;
|
const char *rel_suffix = path + 1;
|
||||||
size_t len = strlen(rel_suffix) + 3;
|
size_t len = strlen(rel_suffix) + 4;
|
||||||
char *new_path = malloc(len);
|
char *new_path = malloc(len);
|
||||||
if (!new_path) {
|
if (!new_path) {
|
||||||
fprintf(stderr, "proc_redirect: malloc failed\n");
|
fprintf(stderr, "proc_redirect: malloc failed\n");
|
||||||
@@ -28,7 +28,8 @@ FILE *fopen(const char *path, const char *mode) {
|
|||||||
}
|
}
|
||||||
new_path[0] = '.';
|
new_path[0] = '.';
|
||||||
new_path[1] = '/';
|
new_path[1] = '/';
|
||||||
strcpy(new_path + 2, rel_suffix);
|
new_path[2] = '.';
|
||||||
|
strcpy(new_path + 3, rel_suffix);
|
||||||
|
|
||||||
FILE *f = real_fopen(new_path, mode);
|
FILE *f = real_fopen(new_path, mode);
|
||||||
free(new_path);
|
free(new_path);
|
||||||
|
|||||||
Reference in New Issue
Block a user