Skip to content

Commit

Permalink
ui/vnc-clipboard: fix inflate_buffer
Browse files Browse the repository at this point in the history
Commit d921fea ("ui/vnc-clipboard: fix infinite loop in
inflate_buffer (CVE-2023-3255)") removed this hunk, but it is still
required, because it can happen that stream.avail_in becomes zero
before coming across a return value of Z_STREAM_END in the loop.

This fixes the host->guest direction of the clipboard with noVNC and
TigerVNC as clients.

Fixes: d921fea ("ui/vnc-clipboard: fix infinite loop in inflate_buffer (CVE-2023-3255)")
Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20231122125826.228189-1-f.ebner@proxmox.com>
(cherry picked from commit ebfbf39)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
foxmox authored and Michael Tokarev committed Dec 13, 2023
1 parent 135ea2b commit 231c201
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ui/vnc-clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ static uint8_t *inflate_buffer(uint8_t *in, uint32_t in_len, uint32_t *size)
}
}

*size = stream.total_out;
inflateEnd(&stream);

return out;

err_end:
inflateEnd(&stream);
err:
Expand Down

0 comments on commit 231c201

Please sign in to comment.