Module: wine Branch: master Commit: cba4bcb47fee29f993d9b722e1d133a85a019add URL: http://source.winehq.org/git/wine.git/?a=commit;h=cba4bcb47fee29f993d9b722e1...
Author: Ken Thomases ken@codeweavers.com Date: Mon Apr 8 15:43:13 2013 -0500
winemac: Handle failure to get clipboard format name; don't use uninitialized buffer.
---
dlls/winemac.drv/clipboard.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 6dfb2a2..53b1448 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -292,7 +292,13 @@ static WINE_CLIPFORMAT *insert_clipboard_format(UINT id, CFStringRef type) { WCHAR buffer[256];
- GetClipboardFormatNameW(format->format_id, buffer, 256); + if (!GetClipboardFormatNameW(format->format_id, buffer, sizeof(buffer) / sizeof(buffer[0]))) + { + WARN("failed to get name for format %s; error 0x%08x\n", debugstr_format(format->format_id), GetLastError()); + HeapFree(GetProcessHeap(), 0, format); + return NULL; + } + if (!strncmpW(buffer, mac_type_name_prefix, strlenW(mac_type_name_prefix))) { const WCHAR *p = buffer + strlenW(mac_type_name_prefix);