From 6a869702e5d5099f156879f16d93a78b799afa2d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 29 Apr 2019 09:59:18 +0200 Subject: 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 --- ctl-lib/ctl-plugin.c | 4 ++-- 1 file 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) { -- cgit 1.2.3-korg