wayland-server: Properly handle EAGAIN from wl_connection_read() commit 3cddb3c692acd3536a7cc8542a29f0cc3c0ac3d6 casted len to an unsigned value to compare to sizeof results. However, wl_connection_read() can fail, setting errno to EAGAIN and returning a value of -1. When cast to an unsigned type this leads to a loop condition of true when it should be false. Signed-off-by: Dipen Somani <dipen.somani@samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/wayland-server.c b/src/wayland-server.c index eb1e500..eab2ee4 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c
@@ -353,7 +353,7 @@ } } - while ((size_t) len >= sizeof p) { + while (len >= 0 && (size_t) len >= sizeof p) { wl_connection_copy(connection, p, sizeof p); opcode = p[1] & 0xffff; size = p[1] >> 16;