mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-07-06 07:14:57 +03:00
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -479,12 +479,14 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Read(IStream *This, void *pv, ULO
|
||||
return STG_E_READFAULT;
|
||||
}
|
||||
|
||||
// A successful request must have produced a buffer. If it did not, fail the
|
||||
// read instead of reporting stale or uninitialized bytes to the caller.
|
||||
if (!req_data)
|
||||
return E_FAIL;
|
||||
|
||||
CopyMemory(pv, req_data, req_size);
|
||||
// A successful request may legitimately return 0 bytes (EOF); only treat a NULL
|
||||
// buffer as an error when a non-zero size was reported.
|
||||
if (req_size > 0)
|
||||
{
|
||||
if (!req_data)
|
||||
return E_FAIL;
|
||||
CopyMemory(pv, req_data, req_size);
|
||||
}
|
||||
free(req_data);
|
||||
|
||||
*pcbRead = req_size;
|
||||
|
||||
Reference in New Issue
Block a user