提交 7ed1ca57 编写于 作者: X xiacong

<fix>

增加dlopen路径检查
Signed-off-by: Nxiacong <xiacong4@huawei.com>
上级 3678d901
...@@ -34,8 +34,10 @@ ...@@ -34,8 +34,10 @@
#ifdef __aarch64__ #ifdef __aarch64__
#define FILTER_LIB_PATH_FORMAT "/system/lib64/lib%s_filter.z.so" #define FILTER_LIB_PATH_FORMAT "/system/lib64/lib%s_filter.z.so"
#define FILTER_LIB_PATH_HEAD "/system/lib64/lib"
#else #else
#define FILTER_LIB_PATH_FORMAT "/system/lib/lib%s_filter.z.so" #define FILTER_LIB_PATH_FORMAT "/system/lib/lib%s_filter.z.so"
#define FILTER_LIB_PATH_HEAD "/system/lib/lib"
#endif #endif
#define FILTER_NAME_FORMAT "g_%sSeccompFilter" #define FILTER_NAME_FORMAT "g_%sSeccompFilter"
#define FILTER_SIZE_STRING "Size" #define FILTER_SIZE_STRING "Size"
...@@ -114,6 +116,10 @@ static int GetSeccompPolicy(const char *filterName, int **handler, ...@@ -114,6 +116,10 @@ static int GetSeccompPolicy(const char *filterName, int **handler,
return INPUT_ERROR; return INPUT_ERROR;
} }
if (strncmp(filterLibRealPath, FILTER_LIB_PATH_HEAD, strlen(FILTER_LIB_PATH_HEAD))) {
return INPUT_ERROR;
}
char filterVaribleName[PATH_MAX] = {0}; char filterVaribleName[PATH_MAX] = {0};
struct sock_filter *filter = NULL; struct sock_filter *filter = NULL;
size_t *filterSize = NULL; size_t *filterSize = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册