Skip to content

Commit

Permalink
server: Use correct type for length in compress()
Browse files Browse the repository at this point in the history
This fixes data type mismatch on 32 bit systems

Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR authored and any1 committed Nov 20, 2024
1 parent 37058d0 commit e0e0ce5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,18 +1509,17 @@ static void ext_clipboard_save_provide_msg(struct nvnc* server, const char* text
memcpy(provide_msg_buf + 4, text, len);
provide_msg_buf[provide_msg_len - 1] = 0;

server->ext_clipboard_provide_msg.length = compressBound(provide_msg_len);
server->ext_clipboard_provide_msg.buffer = malloc(
server->ext_clipboard_provide_msg.length);
unsigned long length = compressBound(provide_msg_len);
server->ext_clipboard_provide_msg.buffer = malloc(length);
if (!server->ext_clipboard_provide_msg.buffer) {
nvnc_log(NVNC_LOG_ERROR, "OOM: %m");
return;
}

int rc;
rc = compress((unsigned char*)server->ext_clipboard_provide_msg.buffer,
&server->ext_clipboard_provide_msg.length,
provide_msg_buf, provide_msg_len);
&length, provide_msg_buf, provide_msg_len);
server->ext_clipboard_provide_msg.length = length;

free(provide_msg_buf);

Expand Down

0 comments on commit e0e0ce5

Please sign in to comment.