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

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


Hi,

the terminating zero should be at the last position (256 - 1) on this
code-path.

This should fix Coverity-310. Still need to have a look at line 686 as that is
potentially writing behind filetype as well.

Changelog
  Make sure we don't write behind filetype

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 c0b468f..1785728 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -670,7 +670,7 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath
                            &filetypelen) == ERROR_SUCCESS)
         {
             filetypelen /= sizeof(WCHAR);
-            filetype[filetypelen] = '\0';
+            filetype[filetypelen - 1] = '\0';
             TRACE("File type: %s\n", debugstr_w(filetype));
         }
         else
-- 
1.4.3.5




More information about the wine-patches mailing list