Skip to content

Commit 679ba7c

Browse files
tobydoxbk138
authored andcommitted
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 c8e7bd2 commit 679ba7c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libvncclient/rfbclient.c

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

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

0 commit comments

Comments
 (0)