mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-12 17:15:21 +00:00
websocket: Avoid possible server crash using websockets
Currently code don't handle if system can't sent the header in a single write command. Don't cause abort but just close the connection. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jeremy White <jwhite@codeweavers.com>
This commit is contained in:
parent
0c2f386beb
commit
39a791a964
@ -439,7 +439,12 @@ int websocket_writev(RedsWebSocket *ws, const struct iovec *iov, int iovcnt)
|
||||
}
|
||||
rc -= header_len;
|
||||
|
||||
spice_assert(rc >= 0);
|
||||
/* TODO this in theory can happen if we can't write the header */
|
||||
if (SPICE_UNLIKELY(rc < 0)) {
|
||||
ws->closed = true;
|
||||
errno = EPIPE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Key point: if we did not write out all the data, remember how
|
||||
much more data the client is expecting, and write that data without
|
||||
|
||||
Loading…
Reference in New Issue
Block a user