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:
RustDesk
2026-07-04 14:55:09 +08:00
committed by GitHub
parent 96ab03aa65
commit cd4ed15214

View File

@@ -479,12 +479,14 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Read(IStream *This, void *pv, ULO
return STG_E_READFAULT; return STG_E_READFAULT;
} }
// A successful request must have produced a buffer. If it did not, fail the // A successful request may legitimately return 0 bytes (EOF); only treat a NULL
// read instead of reporting stale or uninitialized bytes to the caller. // buffer as an error when a non-zero size was reported.
if (!req_data) if (req_size > 0)
return E_FAIL; {
if (!req_data)
CopyMemory(pv, req_data, req_size); return E_FAIL;
CopyMemory(pv, req_data, req_size);
}
free(req_data); free(req_data);
*pcbRead = req_size; *pcbRead = req_size;