summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
Diffstat (limited to 'controller')
-rw-r--r--controller/ctl-config.c4
-rw-r--r--controller/ctl-plugin.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/controller/ctl-config.c b/controller/ctl-config.c
index fe76c90..cf24057 100644
--- a/controller/ctl-config.c
+++ b/controller/ctl-config.c
@@ -35,7 +35,7 @@ char* CtlConfigSearch(const char *dirList, const char* fileName) {
strncpy(controlFile, fileName, CONTROL_MAXPATH_LEN);
} else {
strncpy(controlFile, CONTROL_CONFIG_PRE "-", CONTROL_MAXPATH_LEN);
- strncat(controlFile, GetBinderName(), CONTROL_MAXPATH_LEN);
+ strncat(controlFile, GetBinderName(), strlen(GetBinderName())); // Only possible because returned GetBinderName value is a static variable.
}
// search for default dispatch config file
@@ -56,7 +56,7 @@ char* CtlConfigSearch(const char *dirList, const char* fileName) {
if (index == 0) {
if (strcasestr(filename, controlFile)) {
char filepath[CONTROL_MAXPATH_LEN];
- strncpy(filepath, fullpath, sizeof (filepath));
+ strncpy(filepath, fullpath, strlen(fullpath));
strncat(filepath, "/", strlen("/"));
strncat(filepath, filename, strlen(filename));
return (strdup(filepath));
diff --git a/controller/ctl-plugin.c b/controller/ctl-plugin.c
index 9a34a29..62fdb8b 100644
--- a/controller/ctl-plugin.c
+++ b/controller/ctl-plugin.c
@@ -18,7 +18,7 @@
* Json load using json_unpack https://jansson.readthedocs.io/en/2.9/apiref.html#parsing-and-validating-values
*/
- #define _GNU_SOURCE
+#define _GNU_SOURCE
#include <string.h>
#include <dlfcn.h>
#include <link.h>
@@ -126,9 +126,9 @@ STATIC int PluginLoadOne (CtlPluginT *ctlPlugin, json_object *pluginJ, void* han
}
char pluginpath[CONTROL_MAXPATH_LEN];
- strncpy(pluginpath, fullpath, sizeof (pluginpath));
- strncat(pluginpath, "/", sizeof (pluginpath));
- strncat(pluginpath, filename, sizeof (pluginpath));
+ strncpy(pluginpath, fullpath, strlen(fullpath));
+ strncat(pluginpath, "/", strlen("/"));
+ strncat(pluginpath, filename, strlen(filename));
dlHandle = dlopen(pluginpath, RTLD_NOW);
if (!dlHandle) {
AFB_ERROR("CTL-PLUGIN-LOADONE Fail to load pluginpath=%s err= %s", pluginpath, dlerror());