summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-04-29 09:59:18 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-04-29 11:44:02 +0000
commit32246004633b69c427af3d08b6cdee350cb95fa8 (patch)
tree7e2a934b4e38c8b9afb25be169c332c587093a78
parentc32fc14acde7ef97ebaf99f17143618329f698c0 (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) {