afb-export: Fix heap corruption 06/20906/1 7.0.1 guppy/7.0.1 guppy_7.0.1
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 4 Apr 2019 13:28:03 +0000 (15:28 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Thu, 4 Apr 2019 14:01:19 +0000 (16:01 +0200)
The allocated size wasn't correct when 'path'
was used. The effect be unseen depending on
size and alignment of heap chunks.

Change-Id: Id9f85a0078028319491b51bc3e11cd51e4bc3755
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-export.c

index 62be904..a1112d2 100644 (file)
@@ -1271,7 +1271,7 @@ static struct afb_export *create(
                        return NULL;
        }
        lenapi = strlen(apiname);
-       export = calloc(1, sizeof *export + 1 + lenapi + (path == apiname || !path ? 0 : strlen(path)));
+       export = calloc(1, sizeof *export + 1 + lenapi + (path == apiname || !path ? 0 : 1 + strlen(path)));
        if (!export)
                errno = ENOMEM;
        else {