Skip to content

Commit

Permalink
Copy one extra byte from userspace filename
Browse files Browse the repository at this point in the history
Otherwise we will rewrite paths for filenames that
begins with `/system/bin/su`.

Close #957
  • Loading branch information
kxxt committed Sep 15, 2023
1 parent eac6fd0 commit 37f8d43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/sucompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
return 0;
}

char path[sizeof(su)];
char path[sizeof(su) + 1];
memset(path, 0, sizeof(path));
ksu_strncpy_from_user_nofault(path, *filename_user, sizeof(path));

Expand All @@ -73,7 +73,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
return 0;
}

char path[sizeof(su)];
char path[sizeof(su) + 1];
memset(path, 0, sizeof(path));
ksu_strncpy_from_user_nofault(path, *filename_user, sizeof(path));

Expand Down

0 comments on commit 37f8d43

Please sign in to comment.