From 78d26522c6caa27756d5f6dd209a406e916869f6 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 19 Jul 2011 13:22:07 -0500 Subject: [PATCH 1/2] shell32: Include NULL terminators in the lengths used by SHELL_ArgifyW. All uses assume it works this way, so this fixes some off-by-one errors. --- dlls/shell32/shlexec.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index ff07550..7bbbb2b 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -269,7 +269,12 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp } } - *res = '\0'; + used ++; + if (res - out < len) + *res = '\0'; + else + out[len-1] = '\0'; + TRACE("used %i of %i space\n",used,len); if (out_len) *out_len = used; -- 1.7.2.5