[PATCH] comdlg32: fixed bad size to GetModuleFilenameW

Marcus Meissner marcus at jet.franken.de
Sun Oct 24 04:08:30 CDT 2010


Hi,

I reactivated my old overflow checking patches for a spin,
(hello FORTIFY_SOURCE ;)

Size is in WCHARS, not bytes to this function.

Ciao, Marcus
---
 dlls/comdlg32/filedlg.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 01b068e..2687029 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -2070,7 +2070,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
     HKEY hkey;
 
     /* get the current executable's name */
-    if(!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, sizeof(module_path))){
+    if(!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, sizeof(module_path)/sizeof(module_path[0]))) {
         WARN("GotModuleFileName failed: %d\n", GetLastError());
         return;
     }
@@ -2157,7 +2157,7 @@ static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
     WCHAR module_path[MAX_PATH], *module_name;
 
     /* get the current executable's name */
-    if(!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, sizeof(module_path))){
+    if(!GetModuleFileNameW(GetModuleHandleW(NULL), module_path, sizeof(module_path)/sizeof(module_path[0]))) {
         WARN("GotModuleFileName failed: %d\n", GetLastError());
         return;
     }
-- 
1.7.1



More information about the wine-patches mailing list