using d_path for solution to file path.
This commit is contained in:
@@ -80,6 +80,8 @@ static int load_elf(struct linux_binprm *bprm
|
|||||||
char buf[32];
|
char buf[32];
|
||||||
int l;
|
int l;
|
||||||
int pass;
|
int pass;
|
||||||
|
char pbuf[1024];
|
||||||
|
const char *path;
|
||||||
|
|
||||||
if(bprm->envc == 0)
|
if(bprm->envc == 0)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
@@ -91,7 +93,11 @@ static int load_elf(struct linux_binprm *bprm
|
|||||||
if(elf_ex->e_ident[EI_CLASS] != ELFCLASS64)
|
if(elf_ex->e_ident[EI_CLASS] != ELFCLASS64)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
|
|
||||||
cp = strrchr(bprm->interp, '/');
|
path = d_path(&bprm->file->f_path, pbuf, 1024);
|
||||||
|
if(!path || IS_ERR(path))
|
||||||
|
path = bprm->interp;
|
||||||
|
|
||||||
|
cp = strrchr(path, '/');
|
||||||
if(!cp ||
|
if(!cp ||
|
||||||
!strcmp(cp, "/mcexec") ||
|
!strcmp(cp, "/mcexec") ||
|
||||||
!strcmp(cp, "/ihkosctl") ||
|
!strcmp(cp, "/ihkosctl") ||
|
||||||
@@ -196,11 +202,11 @@ static int load_elf(struct linux_binprm *bprm
|
|||||||
|
|
||||||
if(rc);
|
if(rc);
|
||||||
else if(env_mcexec_wl)
|
else if(env_mcexec_wl)
|
||||||
rc = !pathcheck(bprm->interp, env_mcexec_wl);
|
rc = !pathcheck(path, env_mcexec_wl);
|
||||||
else if(env_mcexec_bl)
|
else if(env_mcexec_bl)
|
||||||
rc = pathcheck(bprm->interp, env_mcexec_bl);
|
rc = pathcheck(path, env_mcexec_bl);
|
||||||
else
|
else
|
||||||
rc = pathcheck(bprm->interp, "/usr:/bin:/sbin:/opt");
|
rc = pathcheck(path, "/usr:/bin:/sbin:/opt");
|
||||||
|
|
||||||
for(ep = env; ep->name; ep++)
|
for(ep = env; ep->name; ep++)
|
||||||
if(ep->val)
|
if(ep->val)
|
||||||
|
|||||||
Reference in New Issue
Block a user