Skip to content

Commit 0645de9

Browse files
committed
libvncclient: fix type of csz
zlib's compress() takes a pointer to a uLong variable. uLong may be 32 bit only while size_t is 64 bit on 64 bit platforms. This causes a compiler warning/error and potentially UB.
1 parent c47e8b1 commit 0645de9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libvncclient/rfbclient.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ sendExtClientCutTextProvide(rfbClient *client, char* data, int len)
18151815
| rfbExtendedClipboard_Text); /*text and provide*/
18161816
const uint32_t be_size = rfbClientSwap32IfLE(len);
18171817
const size_t sz_to_compressed = sizeof(be_size) + len; /*size, data*/
1818-
size_t csz = compressBound(sz_to_compressed + 1); /*tricky, some server need extar byte to flush data*/
1818+
uLong csz = compressBound(sz_to_compressed + 1); /*tricky, some server need extar byte to flush data*/
18191819

18201820
unsigned char *buf = malloc(sz_to_compressed + 1); /*tricky, some server need extra byte to flush data*/
18211821
if (!buf) {

0 commit comments

Comments
 (0)