diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-01 14:43:20 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-02 16:50:49 +0200 |
commit | 41b6d1cff0c53e77630a2de9ea44d7359073681d (patch) | |
tree | 9bd389867777f97e1ad4647e4767951f45ba9782 | |
parent | 43e62871567f782ca48de1b41a9edbc49c3b255e (diff) |
Fix: wrong terminating character handling
snprintf include the terminating character when it writes to
the buffer.
Change-Id: Idca1050deb9af64de1fdd4f08744166b2fa144b1
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | src/aft.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -203,12 +203,12 @@ int afbBindingEntry(afb_api_t apiHandle) { bindingRootDirLen = strlen(bindingRootDir); if(envDirList) { - len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen; + len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen + 2; dirList = malloc(len + 1); - snprintf(dirList, len + 2, "%s:%s:%s", envDirList, bindingRootDir, CONTROL_CONFIG_PATH); + snprintf(dirList, len +1, "%s:%s:%s", envDirList, bindingRootDir, CONTROL_CONFIG_PATH); } else { - len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen; + len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen + 1; dirList = malloc(len + 1); snprintf(dirList, len + 1, "%s:%s", bindingRootDir, CONTROL_CONFIG_PATH); } |