aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugin.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-12-31 10:58:34 +0100
committercbdev <cb@cbcdn.com>2019-12-31 10:58:34 +0100
commit3b4a2f9f3bbe97c5b77eb74ba9c0163b52d33206 (patch)
tree1defeeb5b081b8c951d920298fa10858191d6beb /plugin.c
parent7360766777a7969b76fa306f7381d2d51efa1ebe (diff)
parent87fe68ef7d929b2f79e695df649b374fe0e2c572 (diff)
downloadmidimonster-3b4a2f9f3bbe97c5b77eb74ba9c0163b52d33206.tar.gz
midimonster-3b4a2f9f3bbe97c5b77eb74ba9c0163b52d33206.tar.bz2
midimonster-3b4a2f9f3bbe97c5b77eb74ba9c0163b52d33206.zip
Merge branch 'master' into debian/master
Diffstat (limited to 'plugin.c')
-rw-r--r--plugin.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin.c b/plugin.c
index c7c9812..56d6651 100644
--- a/plugin.c
+++ b/plugin.c
@@ -30,6 +30,11 @@ static int plugin_attach(char* path, char* file){
char* path_separator = "/";
#endif
+ if(!path || !file || !strlen(path)){
+ fprintf(stderr, "Invalid plugin loader path\n");
+ return 1;
+ }
+
lib = calloc(strlen(path) + strlen(file) + 2, sizeof(char));
if(!lib){
fprintf(stderr, "Failed to allocate memory\n");
@@ -37,7 +42,7 @@ static int plugin_attach(char* path, char* file){
}
snprintf(lib, strlen(path) + strlen(file) + 2, "%s%s%s",
path,
- (path[strlen(path)] == path_separator[0]) ? "" : path_separator,
+ (path[strlen(path) - 1] == path_separator[0]) ? "" : path_separator,
file);
handle = dlopen(lib, RTLD_NOW);