mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
calibre-mount-helper: Refuse to mount anythin under /usr, /bin or /sbin
This commit is contained in:
parent
4393d91aef
commit
8b21b4a4ad
@ -44,6 +44,12 @@ int do_mount(const char *dev, const char *mp) {
|
||||
fprintf(stderr, "Specified device node does not exist\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (strncmp("/usr", mp, 4) == 0 || strncmp("/bin", mp, 4) == 0 || strncmp("/sbin", mp, 5) == 0) {
|
||||
fprintf(stderr, "Trying to mount to a mount point under /usr, /bin, /sbin is not allowed\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!exists(mp)) {
|
||||
if (mkdir(mp, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) != 0) {
|
||||
errsv = errno;
|
||||
|
Loading…
x
Reference in New Issue
Block a user