Cygwin: clipboard: Fix a bug in read().

- Fix a bug in fhandler_dev_clipboard::read() that the second read
  fails with 'Bad address'.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-December/250141.html
This commit is contained in:
Takashi Yano 2021-12-07 22:25:34 +09:00
parent c9c5c9e147
commit 2d95c753da
2 changed files with 7 additions and 1 deletions

View File

@ -229,7 +229,7 @@ fhandler_dev_clipboard::read (void *ptr, size_t& len)
if (pos < (off_t) clipbuf->cb_size) if (pos < (off_t) clipbuf->cb_size)
{ {
ret = (len > (clipbuf->cb_size - pos)) ? clipbuf->cb_size - pos : len; ret = (len > (clipbuf->cb_size - pos)) ? clipbuf->cb_size - pos : len;
memcpy (ptr, &clipbuf[1] + pos , ret); memcpy (ptr, (char *) (clipbuf + 1) + pos, ret);
pos += ret; pos += ret;
} }
} }

View File

@ -0,0 +1,6 @@
Bug Fixes
---------
- Fix a bug in fhandler_dev_clipboard::read() that the second read
fails with 'Bad address'.
Addresses: https://cygwin.com/pipermail/cygwin/2021-December/250141.html