* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Drop gratuitios

handling of membuffer.  It's NULL anyway.
	(fhandler_dev_clipboard::lseek): Set membuffer to NULL after freeing
	it to avoid subsequent crashes when accessing invalid pointer.
This commit is contained in:
Corinna Vinschen 2013-10-25 15:04:24 +00:00
parent 494c626414
commit f0b101007a
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2013-10-25 Corinna Vinschen <corinna@vinschen.de>
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Drop gratuitios
handling of membuffer. It's NULL anyway.
(fhandler_dev_clipboard::lseek): Set membuffer to NULL after freeing
it to avoid subsequent crashes when accessing invalid pointer.
2013-10-25 Corinna Vinschen <corinna@vinschen.de>
* devices.in (dev_storage): Map /dev/random and /dev/urandom to

View File

@ -69,9 +69,6 @@ fhandler_dev_clipboard::open (int flags, mode_t)
{
set_flags (flags | O_TEXT);
pos = 0;
if (membuffer)
free (membuffer);
membuffer = NULL;
if (!cygnativeformat)
cygnativeformat = RegisterClipboardFormatW (CYGWIN_NATIVE);
nohandle (true);
@ -336,7 +333,10 @@ fhandler_dev_clipboard::lseek (off_t offset, int whence)
pos = offset;
/* treat seek like rewind */
if (membuffer)
free (membuffer);
{
free (membuffer);
membuffer = NULL;
}
msize = 0;
return 0;
}

View File

@ -26,3 +26,5 @@ Bug fixes:
- Properly set process sid rather than always using -1.
Fixes: http://cygwin.com/ml/cygwin/2013-10/threads.html#00237
- Fix a potential crash after calling lseek on /dev/clipboard.