diff options
Diffstat (limited to 'lib/misc/sharedlib.c')
-rw-r--r-- | lib/misc/sharedlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/misc/sharedlib.c b/lib/misc/sharedlib.c index cab2909..4c2d178 100644 --- a/lib/misc/sharedlib.c +++ b/lib/misc/sharedlib.c @@ -15,9 +15,7 @@ #include "lib.h" #include "config.h" -#include "lvm-string.h" #include "sharedlib.h" -#include "toolcontext.h" #include <limits.h> #include <sys/stat.h> @@ -34,8 +32,10 @@ void get_shared_library_path(struct cmd_context *cmd, const char *libname, if (libname[0] == '/' || !(lib_dir = find_config_tree_str(cmd, "global/library_dir", 0)) || (dm_snprintf(path, path_len, "%s/%s", lib_dir, - libname) == -1) || stat(path, &info) == -1) - strncpy(path, libname, path_len); + libname) == -1) || stat(path, &info) == -1) { + strncpy(path, libname, path_len - 1); + path[path_len - 1] = '\0'; + } } void *load_shared_library(struct cmd_context *cmd, const char *libname, |