From 262f05782b0c7285960a2e2d2beac9b778ce555f Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 18 Mar 2013 12:21:45 +0000 Subject: [PATCH] embryo_cc: Fix possible buffer overflow in setconfig() Need to account for the space of the trailing '/' as well. Signed-off-by: Daniel Willmann --- src/bin/embryo/embryo_cc_sc1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c index 9fd75092a4..14b6b1cbc1 100644 --- a/src/bin/embryo/embryo_cc_sc1.c +++ b/src/bin/embryo/embryo_cc_sc1.c @@ -683,7 +683,8 @@ setconfig(char *root) * to the list in that case */ *(ptr + 1) = '\0'; - if (strlen(path) < (sizeof(path) - 1 - 7)) + /* Need room for 'include' and DIRSEP_CHAR - so 8 chars - and \0 */ + if (strlen(path) < (sizeof(path) - 1 - 8)) { strcat(path, "include"); }