Alexandre Julliard : comdlg32: Avoid crash when driver name doesn' t contain a backslash.
Module: wine Branch: master Commit: 67a0db3c38ead3178912d44604fd90440b57f5a8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=67a0db3c38ead3178912d44604... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 24 12:48:00 2012 +0100 comdlg32: Avoid crash when driver name doesn't contain a backslash. --- dlls/comdlg32/printdlg.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index d074563..7ce9148 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -321,8 +321,10 @@ static BOOL PRINTDLG_CreateDevNames(HGLOBAL *hmem, const char* DeviceDriverName, LPDEVNAMES lpDevNames; char buf[260]; DWORD dwBufLen = sizeof(buf); + const char *p; - DeviceDriverName = strrchr(DeviceDriverName, '\\') + 1; + p = strrchr( DeviceDriverName, '\\' ); + if (p) DeviceDriverName = p + 1; size = strlen(DeviceDriverName) + 1 + strlen(DeviceName) + 1 @@ -366,8 +368,10 @@ static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName, LPDEVNAMES lpDevNames; WCHAR bufW[260]; DWORD dwBufLen = sizeof(bufW) / sizeof(WCHAR); + const WCHAR *p; - DeviceDriverName = strrchrW(DeviceDriverName, '\\') + 1; + p = strrchrW( DeviceDriverName, '\\' ); + if (p) DeviceDriverName = p + 1; size = sizeof(WCHAR)*lstrlenW(DeviceDriverName) + 2 + sizeof(WCHAR)*lstrlenW(DeviceName) + 2
participants (1)
-
Alexandre Julliard