From 72828e008080562b6840867ee6f99ccf1b1e8728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gouget?= Date: Sat, 13 Jan 2001 00:27:13 +0000 Subject: [PATCH] In STATUSBAR_GetTipText{a,W, always put a terminating '\0' in the buffer. Pass a buffer of sufficient size to TTM_GETTEXTA. --- dlls/comctl32/status.c | 43 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index a11b0146ee2..933c156da06 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -457,18 +457,22 @@ static LRESULT STATUSBAR_GetTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) { STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd); + LPSTR tip = (LPSTR)lParam; - if (infoPtr->hwndToolTip) { - TTTOOLINFOA ti; - ti.cbSize = sizeof(TTTOOLINFOA); - ti.hwnd = hwnd; - ti.uId = LOWORD(wParam); - SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti); + if (tip) { + CHAR buf[INFOTIPSIZE]; + buf[0]='\0'; - if (ti.lpszText) - lstrcpynA ((LPSTR)lParam, ti.lpszText, HIWORD(wParam)); + if (infoPtr->hwndToolTip) { + TTTOOLINFOA ti; + ti.cbSize = sizeof(TTTOOLINFOA); + ti.hwnd = hwnd; + ti.uId = LOWORD(wParam); + ti.lpszText = buf; + SendMessageA(infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti); + } + lstrcpynA(tip, buf, HIWORD(wParam)); } - return 0; } @@ -477,16 +481,21 @@ static LRESULT STATUSBAR_GetTipTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) { STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd); + LPWSTR tip = (LPWSTR)lParam; - if (infoPtr->hwndToolTip) { - TTTOOLINFOW ti; - ti.cbSize = sizeof(TTTOOLINFOW); - ti.hwnd = hwnd; - ti.uId = LOWORD(wParam); - SendMessageW (infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti); + if (tip) { + WCHAR buf[INFOTIPSIZE]; + buf[0]=0; - if (ti.lpszText) - lstrcpynW ((LPWSTR)lParam, ti.lpszText, HIWORD(wParam)); + if (infoPtr->hwndToolTip) { + TTTOOLINFOW ti; + ti.cbSize = sizeof(TTTOOLINFOW); + ti.hwnd = hwnd; + ti.uId = LOWORD(wParam); + ti.lpszText = buf; + SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti); + } + lstrcpynW(tip, buf, HIWORD(wParam)); } return 0;