diff --git a/src/module.c b/src/module.c index 597be484..35d35125 100644 --- a/src/module.c +++ b/src/module.c @@ -31,6 +31,7 @@ #include "cluster.h" #include "rdb.h" #include +#include #include /* -------------------------------------------------------------------------- @@ -6984,6 +6985,15 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) { int (*onload)(void *, void **, int); void *handle; RedisModuleCtx ctx = REDISMODULE_CTX_INIT; + + struct stat st; + if (stat(path, &st) == 0) + { // this check is best effort + if (!(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { + serverLog(LL_WARNING, "Module %s failed to load: It does not have execute permissions.", path); + return C_ERR; + } + } handle = dlopen(path,RTLD_NOW|RTLD_LOCAL); if (handle == NULL) {