aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-04-04 15:28:03 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-04-04 15:34:02 +0200
commitce53d8ec8550965084304e975a0636b40d7e64a7 (patch)
treef951bc5a7a603b3f25b85ee1e8d60ef210f540a3
parent60cd11786766ebc148b7ec088962dd6e112f8762 (diff)
afb-export: Fix heap corruption
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>
-rw-r--r--src/afb-export.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/afb-export.c b/src/afb-export.c
index b46e6a08..2c6522f0 100644
--- a/src/afb-export.c
+++ b/src/afb-export.c
@@ -1372,7 +1372,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 {