shell32: autocomplete: don't use sel uninitialized (fixes bug #7554)
Mikołaj Zalewski
mikolaj at zalewski.pl
Mon Mar 26 06:02:32 CDT 2007
-------------- next part --------------
From ac395bd3d87313ff532514a4112c6de154e5e279 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Miko=C5=82aj_Zalewski?= <mikolaj at zalewski.pl>
Date: Tue, 20 Mar 2007 23:04:36 +0100
Subject: [PATCH] shell32: autocomplete: don't use sel uninitialized (fixes bug #7554)
---
dlls/shell32/autocomplete.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 2ffe0d6..0d95de3 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -624,7 +624,7 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
IAutoCompleteImpl *This = (IAutoCompleteImpl *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
WCHAR *msg;
- int sel = -1, len;
+ int sel, len;
switch (uMsg) {
case WM_MOUSEMOVE:
@@ -632,9 +632,11 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0);
break;
case WM_LBUTTONDOWN:
+ sel = (INT)SendMessageW(hwnd, LB_GETCURSEL, 0, 0);
+ if (sel < 0)
+ break;
len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL);
msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
- sel = (INT)SendMessageW(hwnd, LB_GETCURSEL, 0, 0);
SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg);
SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg));
--
1.4.4.2
More information about the wine-patches
mailing list