fix name length to copy.

This commit is contained in:
Zhang Zhaolong 2013-11-21 13:35:21 +08:00
parent b79ce07137
commit c196e0b2c1

View File

@ -143,10 +143,19 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
ZeroMemory(format_data + len, 32);
if (format >= CF_MAX) {
static wchar_t wName[MAX_PATH] = {0};
int wLen;
ZeroMemory(wName, MAX_PATH*2);
GetClipboardFormatNameW(format, wName, MAX_PATH);
memcpy(format_data + len, wName, 32); /* truncate the long name to 32 bytes */
wLen = wcslen(wName);
if (wLen < 16)
{
memcpy(format_data + len, wName, wLen * sizeof(WCHAR));
}
else
{
memcpy(format_data + len, wName, 32); /* truncate the long name to 32 bytes */
}
}
len += 32;
}