[Spice-devel] udscs: Fix a potential NULL pointer dereference

Francois Gouget fgouget at codeweavers.com
Thu Dec 1 04:19:33 UTC 2016


udscs_server_fill_fds() should accept being passed a NULL pointer.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 src/udscs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/udscs.c b/src/udscs.c
index 414dce5..fdd75a4 100644
--- a/src/udscs.c
+++ b/src/udscs.c
@@ -495,11 +495,12 @@ int udscs_server_fill_fds(struct udscs_server *server, fd_set *readfds,
         fd_set *writefds)
 {
     struct udscs_connection *conn;
-    int nfds = server->fd + 1;
+    int nfds;
 
     if (!server)
         return -1;
 
+    nfds = server->fd + 1;
     FD_SET(server->fd, readfds);
 
     conn = server->connections_head.next;
-- 
2.10.2


More information about the Spice-devel mailing list