Correct filename padding skip in CLIPRDR_FILEDESCRIPTOR
@@ -565,6 +565,7 @@ static int
clipboard_c2s_in_file_info(struct stream *s, struct clip_file_desc *cfd)
{
int num_chars;
+ int filename_bytes;
int ex_bytes;
in_uint32_le(s, cfd->flags);
@@ -576,11 +577,9 @@ clipboard_c2s_in_file_info(struct stream *s, struct clip_file_desc *cfd)
in_uint32_le(s, cfd->fileSizeHigh);
in_uint32_le(s, cfd->fileSizeLow);
num_chars = sizeof(cfd->cFileName);
- clipboard_in_unicode(s, cfd->cFileName, &num_chars);
- ex_bytes = 512 - num_chars * 2;
- ex_bytes -= 2;
+ filename_bytes = clipboard_in_unicode(s, cfd->cFileName, &num_chars);
+ ex_bytes = 520 - filename_bytes;
in_uint8s(s, ex_bytes);
- in_uint8s(s, 8); /* pad */
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_c2s_in_file_info:");
LOG_DEVEL(LOG_LEVEL_DEBUG, " flags 0x%8.8x", cfd->flags);
LOG_DEVEL(LOG_LEVEL_DEBUG, " fileAttributes 0x%8.8x", cfd->fileAttributes);
