raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=1c893b064ffbe3d138c478e8aecc195fc92069e5

commit 1c893b064ffbe3d138c478e8aecc195fc92069e5
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Tue Aug 6 18:30:30 2019 +0100

    wl dnd - check socketpair and fcntl return values
    
    fix CID 1403951
---
 src/modules/xwayland/dnd.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/modules/xwayland/dnd.c b/src/modules/xwayland/dnd.c
index dd56b22a3..b18f4c0d2 100644
--- a/src/modules/xwayland/dnd.c
+++ b/src/modules/xwayland/dnd.c
@@ -456,21 +456,30 @@ _xwl_selection_request(void *d EINA_UNUSED, int t 
EINA_UNUSED, Ecore_X_Event_Sel
                E_Client *ec;
                int fds[2];
 
+               if (socketpair(AF_UNIX, (SOCK_STREAM | SOCK_CLOEXEC), 0, fds) 
!= 0)
+                 break;
+               if (fcntl(fds[0], F_SETFL, O_NONBLOCK) != 0)
+                 {
+                    close(fds[0]);
+                    close(fds[1]);
+                    break;
+                 }
                p = E_NEW(Pipe, 1);
-               socketpair(AF_UNIX, (SOCK_STREAM | SOCK_CLOEXEC), 0, fds);
-               fcntl(fds[0], F_SETFL, O_NONBLOCK);
-               p->fdh = ecore_main_fd_handler_add(fds[0], ECORE_FD_READ, 
_xwl_pipe_read, p, NULL, NULL);
-               p->win = ev->requestor;
-               p->source = source;
-               wl_data_source_send_send(source->resource, type, fds[1]);
-               close(fds[1]);
-               p->atom = ev->target;
-               p->selection = ev->selection;
-               p->property = ev->property;
-               ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->requestor);
-               if (ec && ec->override)
-                 ecore_x_window_sniff(ev->requestor);
-               eina_hash_add(pipes, &p->win, p);
+               if (p)
+                 {
+                    p->fdh = ecore_main_fd_handler_add(fds[0], ECORE_FD_READ, 
_xwl_pipe_read, p, NULL, NULL);
+                    p->win = ev->requestor;
+                    p->source = source;
+                    wl_data_source_send_send(source->resource, type, fds[1]);
+                    close(fds[1]);
+                    p->atom = ev->target;
+                    p->selection = ev->selection;
+                    p->property = ev->property;
+                    ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->requestor);
+                    if (ec && ec->override)
+                      ecore_x_window_sniff(ev->requestor);
+                    eina_hash_add(pipes, &p->win, p);
+                 }
                break;
             }
      }

-- 


Reply via email to