From: José Bollo Date: Thu, 4 Apr 2019 13:28:03 +0000 (+0200) Subject: afb-export: Fix heap corruption X-Git-Tag: guppy/7.0.1^0 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=commitdiff_plain;h=f878e8026a9c76311327eb840dc9252e9ed87379 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 --- diff --git a/src/afb-export.c b/src/afb-export.c index 62be9040..a1112d23 100644 --- a/src/afb-export.c +++ b/src/afb-export.c @@ -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 {