[shell32] Make sure we don't write behind cmd (Coverity)

Paul Vriens paul.vriens.wine at gmail.com
Sun Nov 12 05:40:23 CST 2006


Hi,

the terminating zero should be at the last position (256 - 1).

Should fix Coverity-311.

Changelog
  Make sure we don't write behind cmd

Cheers,

Paul.
  
---
 dlls/shell32/shlexec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index c618def..c0b468f 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -901,7 +901,7 @@ static UINT_PTR execute_from_key(LPWSTR
 
         /* Is there a replace() function anywhere? */
         cmdlen /= sizeof(WCHAR);
-        cmd[cmdlen] = '\0';
+        cmd[cmdlen - 1] = '\0';
         if (!SHELL_ArgifyW(param, sizeof(param)/sizeof(WCHAR), cmd, lpFile, psei->lpIDList, szCommandline, &resultLen))
         {
             /* looks like there is no %1 param in the cmd, add one */
-- 
1.4.3.5




More information about the wine-patches mailing list