mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 16:34:18 +09:00
[winpr,stream] Check Stream_SetLength return
This commit is contained in:
@@ -478,7 +478,9 @@ static UINT ainput_process_message(ainput_server* ainput)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, ActualBytesReturned);
|
||||
if (!Stream_SetLength(s, ActualBytesReturned))
|
||||
goto out;
|
||||
|
||||
{
|
||||
const UINT16 MessageId = Stream_Get_UINT16(s);
|
||||
|
||||
|
||||
@@ -400,7 +400,12 @@ static DWORD WINAPI audin_server_thread_func(LPVOID arg)
|
||||
break;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
{
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLengthWLog(audin->log, s, SNDIN_HEADER_SIZE))
|
||||
{
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
|
||||
@@ -322,7 +322,9 @@ static UINT disp_server_handle_messages(DispServerContext* context)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
Stream_ResetPosition(s);
|
||||
|
||||
while (Stream_GetPosition(s) < Stream_Length(s))
|
||||
|
||||
@@ -252,7 +252,9 @@ static UINT gfxredir_server_handle_messages(GfxRedirServerContext* context)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
Stream_ResetPosition(s);
|
||||
|
||||
while (Stream_GetPosition(s) < Stream_Length(s))
|
||||
|
||||
@@ -348,7 +348,9 @@ static UINT location_process_message(location_server* location)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
goto out;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, LOCATION_HEADER_SIZE))
|
||||
return ERROR_NO_DATA;
|
||||
|
||||
|
||||
@@ -2250,7 +2250,11 @@ static DWORD WINAPI rdpdr_server_thread(LPVOID arg)
|
||||
if (BytesReturned >= RDPDR_HEADER_LENGTH)
|
||||
{
|
||||
Stream_ResetPosition(s);
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
{
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
goto out_stream;
|
||||
}
|
||||
|
||||
while (Stream_GetRemainingLength(s) >= RDPDR_HEADER_LENGTH)
|
||||
{
|
||||
|
||||
@@ -298,7 +298,9 @@ static UINT enumerator_process_message(enumerator_server* enumerator)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, CAM_HEADER_SIZE))
|
||||
return ERROR_NO_DATA;
|
||||
|
||||
|
||||
@@ -504,7 +504,9 @@ static UINT device_process_message(device_server* device)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
goto out;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, CAM_HEADER_SIZE))
|
||||
return ERROR_NO_DATA;
|
||||
|
||||
|
||||
@@ -271,7 +271,9 @@ static UINT mouse_cursor_process_message(mouse_cursor_server* mouse_cursor)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
goto out;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, RDPEMSC_HEADER_SIZE))
|
||||
return ERROR_NO_DATA;
|
||||
|
||||
|
||||
@@ -1869,7 +1869,9 @@ UINT rdpgfx_server_handle_messages(RdpgfxServerContext* context)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
Stream_ResetPosition(s);
|
||||
|
||||
while (Stream_GetPosition(s) < Stream_Length(s))
|
||||
|
||||
@@ -181,7 +181,9 @@ static UINT telemetry_process_message(telemetry_server* telemetry)
|
||||
goto out;
|
||||
}
|
||||
|
||||
Stream_SetLength(s, BytesReturned);
|
||||
if (!Stream_SetLength(s, BytesReturned))
|
||||
goto out;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
|
||||
return ERROR_NO_DATA;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user