[PATCH 4/4] wayland-server: Abort if a read from a client gives 0 length

Jason Ekstrand jason at jlekstrand.net
Sun Sep 28 21:31:25 PDT 2014


On Sep 28, 2014 11:49 AM, "Karsten Otto" <karsten.otto at posteo.de> wrote:
>
> From: Philip Withnall <philip at tecnocode.co.uk>
>
> This happens if the socket has been gracefully closed.
>
> [KAO: It prevents a potential infinite loop when using a different
> event handling mechanism than epoll, if said mechanism cannot
> distinguish EOF from regular read (e.g. select).]
> ---
>  src/wayland-server.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index 674aeca..85741cb 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -260,7 +260,7 @@ wl_client_connection_data(int fd, uint32_t mask, void
*data)
>         len = 0;
>         if (mask & WL_EVENT_READABLE) {
>                 len = wl_connection_read(connection);
> -               if (len < 0 && errno != EAGAIN) {
> +               if (len == 0 || (len < 0 && errno != EAGAIN)) {
>                         wl_client_destroy(client);
>                         return 1;

It seems to me as if we should push this up the pipe to wl_connection_read
so we fix it server-side too.

>                 }
> --
> 1.9.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140928/ab15cab1/attachment.html>


More information about the wayland-devel mailing list