diff options
author | cbdev <cb@cbcdn.com> | 2019-12-14 23:49:40 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2019-12-14 23:49:40 +0100 |
commit | 4b063b0017ff262e3d6757062a297082a808a3e2 (patch) | |
tree | caac349556ddced8ca103d20d120837101e73da6 /plugin.c | |
parent | 3d7291df090350365b78550bfc8152ee2576f6a9 (diff) | |
download | midimonster-4b063b0017ff262e3d6757062a297082a808a3e2.tar.gz midimonster-4b063b0017ff262e3d6757062a297082a808a3e2.tar.bz2 midimonster-4b063b0017ff262e3d6757062a297082a808a3e2.zip |
Fix minor bug in plugin path setup
Diffstat (limited to 'plugin.c')
-rw-r--r-- | plugin.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); |