mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-20 03:11:02 +03:00
address copilot review findings in wf_cliprdr.c
- Reject a negative FILECONTENTS_SIZE result: m_lSize is unsigned, so a negative value became a huge bogus stream size that keeps reads going. - Use a unique per-stream counter as the CLIPRDR streamId instead of a truncated IStream pointer, which could collide or be reused after free (and leaked heap addresses to the peer). - Add req_f_request_mutex to serialize whole file-contents request/response cycles, enforcing the previously assumed one-outstanding-request invariant when multiple streams are read concurrently. Bounded acquire so a wedged request fails the read instead of hanging a consumer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,8 +84,7 @@ START_TEST(test_file_contents_request_initializes_optional_fields)
|
||||
|
||||
ck_assert_ptr_nonnull(clipboard.req_f_mutex);
|
||||
ck_assert_ptr_nonnull(clipboard.req_fevent);
|
||||
rc = cliprdr_send_request_filecontents(&clipboard, 1, (const void *)(ULONG_PTR)7,
|
||||
0, FILECONTENTS_SIZE, 0, 0, 0);
|
||||
rc = cliprdr_send_request_filecontents(&clipboard, 1, 7, 0, FILECONTENTS_SIZE, 0, 0, 0);
|
||||
ck_assert_int_eq(rc, CHANNEL_RC_OK);
|
||||
ck_assert_int_eq(clipboard.req_f_stream_id_expected, 7);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user