forked from enlightenment/efl
ecore-evas-wayland: Check for valid 'fd' before passing to write()
write() cannot be passed a negative value. If ecore_main_fd_handler_fd_get returns -1, then this is an issue. Check for valid fd being returned from fd_handler_fd_get and if it is negative, then cleanup and get out. Fixes CID1420318
This commit is contained in:
parent
be87c4a0c2
commit
8009817d07
|
@ -2603,9 +2603,12 @@ typedef struct {
|
|||
static Eina_Bool
|
||||
_write_to_fd(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
int fd = ecore_main_fd_handler_fd_get(fd_handler);
|
||||
int fd;
|
||||
Delayed_Writing *slice = data;
|
||||
|
||||
fd = ecore_main_fd_handler_fd_get(fd_handler);
|
||||
if (fd < 0) goto end;
|
||||
|
||||
size_t len = write(fd, slice->slice.mem + slice->written_bytes, slice->slice.len - slice->written_bytes);
|
||||
|
||||
slice->written_bytes += len;
|
||||
|
@ -2615,13 +2618,13 @@ _write_to_fd(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
}
|
||||
else
|
||||
{
|
||||
end:
|
||||
ecore_main_fd_handler_del(fd_handler);
|
||||
free(slice->slice.mem);
|
||||
free(slice);
|
||||
close(fd);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
Loading…
Reference in New Issue