summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-01 14:43:20 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-02 16:50:49 +0200
commit41b6d1cff0c53e77630a2de9ea44d7359073681d (patch)
tree9bd389867777f97e1ad4647e4767951f45ba9782 /src
parent43e62871567f782ca48de1b41a9edbc49c3b255e (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>
Diffstat (limited to 'src')
-rw-r--r--src/aft.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/aft.c b/src/aft.c
index 76fb6a1..df0c69b 100644
--- a/src/aft.c
+++ b/src/aft.c
@@ -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);
}