aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-04-29 09:59:18 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-04-29 08:22:13 +0000
commit6a869702e5d5099f156879f16d93a78b799afa2d (patch)
tree94fd3911c87f63ba55a7b87c52e63531d78ab4b4
parentbcd8dbb7b805f80cc4576e5c499f6944fb1da23b (diff)
Fix: wrong string length size used
Fix: wrong string length size used to register l2c functions leading to have striped functions named registered. Change-Id: I741ccd08f75da154d9fc1b22d5eacc3c00e66b8c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-plugin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 0a14e20..6839a01 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -125,8 +125,8 @@ static int PluginLoadCOne(afb_api_t apiHandle, const char *pluginpath, json_obje
size_t p_length = 6 + strlen(l2cName);
funcName = malloc(p_length + 1);
- strncpy(funcName, "lua2c_", p_length);
- strncat(funcName, l2cName, sizeof(funcName) - strlen (funcName) + 1);
+ strncpy(funcName, "lua2c_", p_length + 1);
+ strncat(funcName, l2cName, p_length - strlen (funcName) + 1);
Lua2cFunctionT l2cFunction = (Lua2cFunctionT) dlsym(dlHandle, funcName);
if (!l2cFunction) {