From: Phil Pennock Date: Sat, 19 May 2018 16:09:55 +0000 (-0400) Subject: Safer handling of argument-logging memory of cwd X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/805fd869d551c36d1d77ab2b292a7008d643ca79 Safer handling of argument-logging memory of cwd --- diff --git a/src/src/exim.c b/src/src/exim.c index c21d9eb7d..810550dd5 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -4091,8 +4091,11 @@ if (((debug_selector & D_any) != 0 || LOGGING(arguments)) Ustrcpy(p, "cwd= (failed)"); Ustrncpy(p + 4, initial_cwd, big_buffer_size-5); + p += 4 + Ustrlen(initial_cwd); + /* in case p is near the end and we don't provide enough space for + * string_format to be willing to write. */ + *p = '\0'; - while (*p) p++; (void)string_format(p, big_buffer_size - (p - big_buffer), " %d args:", argc); while (*p) p++; for (i = 0; i < argc; i++)