LibVNC / libvncserver

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.
GNU General Public License v2.0
1.08k stars 483 forks source link

Fix Extended Clipboard implementation issues #561

Open gujjwal00 opened 1 year ago

gujjwal00 commented 1 year ago
  1. According to spec, clipboard text is null terminated and text length includes the null byte. This is how LibVNCServer and other clients encode this. Fixed by 2nd commit https://github.com/LibVNC/libvncserver/commit/7ff0a53d565b6f03380b08b89d05757be82b9c34

  2. This is a big one. Many servers (including LibVNCServer) can't properly handle zlib streams created by compress() function of zlib library. When decompressing such streams, inflate() correctly returns Z_STREAM_END, but these servers are only expecting Z_OK. So they end up crashing, while LibVNCserver abruptly disconnects from client.

    This is probably why the original PR #552 was not working. New PR simply suppressed it by adding extra byte, which made inflate() return Z_OK.

Solution:

gujjwal00 commented 1 year ago

cc @wuhanck

wuhanck commented 1 year ago

it looks ok. it is safer if client dont include \0 in the end.