1
0
Fork 0
forked from len0rd/rockbox

Agptek Rocker: Restrict root directory to SD only

Actual / of underlying linux OS should not be available to user.
I am still not sure if implementation is correct. It doesn't
perform any relative path sandboxing for example.

Change-Id: Ic577a10f3947f6e950e2c4d03173f9f207395eb7
This commit is contained in:
Marcin Bukat 2018-03-02 21:45:52 +01:00
parent 09fde79ec8
commit 0538ba3d59
4 changed files with 14 additions and 4 deletions

View file

@ -21,6 +21,7 @@
#include <string.h> /* size_t */
#include <dlfcn.h>
#include "file.h"
#include "debug.h"
#include "load_code.h"
@ -28,7 +29,11 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size)
{
(void)buf;
(void)buf_size;
void *handle = dlopen(filename, RTLD_NOW);
char path[MAX_PATH];
const char *fpath = handle_special_dirs(filename, 0, path, sizeof(path));
void *handle = dlopen(fpath, RTLD_NOW);
if (handle == NULL)
{
DEBUGF("failed to load %s\n", filename);