diff options
author | cbdev <cb@cbcdn.com> | 2019-12-22 13:19:37 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2019-12-22 13:19:37 +0100 |
commit | a305f5d9b2794315fb536dbe4d4949f1cf26aeea (patch) | |
tree | 1e9180b69347396a0f71e2ca1fb3488c16a01c45 /plugin.c | |
parent | b5d5f26835ea8840fc3aedd38780f3025d2959b3 (diff) | |
parent | 172d8a210f7df36a26b01d2fe018ff4c959a6987 (diff) | |
download | midimonster-a305f5d9b2794315fb536dbe4d4949f1cf26aeea.tar.gz midimonster-a305f5d9b2794315fb536dbe4d4949f1cf26aeea.tar.bz2 midimonster-a305f5d9b2794315fb536dbe4d4949f1cf26aeea.zip |
Merge branch 'master' into rtpmidi
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); |