[core,capability] Fix reallocation of ReceivedCapabilityData

if the size is 0 do not abort but continue.
This commit is contained in:
akallabeth 2023-01-24 12:52:50 +01:00 committed by Martin Fleisz
parent 7afab06e4e
commit f355c9addd

View File

@ -3982,7 +3982,7 @@ BOOL rdp_read_capability_set(wStream* sub, UINT16 type, rdpSettings* settings, B
WINPR_ASSERT(settings->ReceivedCapabilityData); WINPR_ASSERT(settings->ReceivedCapabilityData);
tmp = realloc(settings->ReceivedCapabilityData[type], size); tmp = realloc(settings->ReceivedCapabilityData[type], size);
if (!tmp) if (!tmp && (size > 0))
return FALSE; return FALSE;
memcpy(tmp, Stream_Buffer(sub), size); memcpy(tmp, Stream_Buffer(sub), size);
settings->ReceivedCapabilityData[type] = tmp; settings->ReceivedCapabilityData[type] = tmp;