[core] fix issues with value ranges written

This commit is contained in:
akallabeth 2024-10-22 12:21:43 +02:00
parent 04a5bbed4a
commit 738cbd54b2
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
2 changed files with 26 additions and 8 deletions

View File

@ -151,7 +151,11 @@ BOOL multitransport_client_send_response(rdpMultitransport* multi, UINT32 reqId,
} }
Stream_Write_UINT32(s, reqId); /* requestId (4 bytes) */ Stream_Write_UINT32(s, reqId); /* requestId (4 bytes) */
Stream_Write_UINT32(s, hr); /* HResult (4 bytes) */
/* [MS-RDPBCGR] 2.2.15.2 Client Initiate Multitransport Response PDU defines this as 4byte
* UNSIGNED but https://learn.microsoft.com/en-us/windows/win32/learnwin32/error-codes-in-com
* defines this as signed... assume the spec is (implicitly) assuming twos complement. */
Stream_Write_INT32(s, hr); /* HResult (4 bytes) */
return rdp_send_message_channel_pdu(multi->rdp, s, SEC_TRANSPORT_RSP); return rdp_send_message_channel_pdu(multi->rdp, s, SEC_TRANSPORT_RSP);
} }

View File

@ -226,10 +226,8 @@ BOOL rdp_read_client_time_zone(wStream* s, rdpSettings* settings)
BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings) BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
{ {
LPTIME_ZONE_INFORMATION tz = { 0 };
WINPR_ASSERT(settings); WINPR_ASSERT(settings);
tz = settings->ClientTimeZone; const LPTIME_ZONE_INFORMATION tz = settings->ClientTimeZone;
if (!tz) if (!tz)
return FALSE; return FALSE;
@ -238,8 +236,12 @@ BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
if (!Stream_EnsureRemainingCapacity(s, 4ull + sizeof(tz->StandardName))) if (!Stream_EnsureRemainingCapacity(s, 4ull + sizeof(tz->StandardName)))
return FALSE; return FALSE;
/* Bias */ /* Bias defined in windows headers as LONG
Stream_Write_UINT32(s, tz->Bias); * but [MS-RDPBCGR] 2.2.1.11.1.1.1.1 Time Zone Information (TS_TIME_ZONE_INFORMATION) defines it
* as unsigned.... assume the spec is buggy as an unsigned value only works on half of the
* world.
*/
Stream_Write_INT32(s, tz->Bias);
/* standardName (64 bytes) */ /* standardName (64 bytes) */
Stream_Write(s, tz->StandardName, sizeof(tz->StandardName)); Stream_Write(s, tz->StandardName, sizeof(tz->StandardName));
/* StandardDate */ /* StandardDate */
@ -250,7 +252,13 @@ BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
/* StandardBias */ /* StandardBias */
if (!Stream_EnsureRemainingCapacity(s, 4ull + sizeof(tz->DaylightName))) if (!Stream_EnsureRemainingCapacity(s, 4ull + sizeof(tz->DaylightName)))
return FALSE; return FALSE;
Stream_Write_UINT32(s, tz->StandardBias);
/* StandardBias defined in windows headers as LONG
* but [MS-RDPBCGR] 2.2.1.11.1.1.1.1 Time Zone Information (TS_TIME_ZONE_INFORMATION) defines it
* as unsigned.... assume the spec is buggy as an unsigned value only works on half of the
* world.
*/
Stream_Write_INT32(s, tz->StandardBias);
/* daylightName (64 bytes) */ /* daylightName (64 bytes) */
Stream_Write(s, tz->DaylightName, sizeof(tz->DaylightName)); Stream_Write(s, tz->DaylightName, sizeof(tz->DaylightName));
@ -261,7 +269,13 @@ BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
/* DaylightBias */ /* DaylightBias */
if (!Stream_EnsureRemainingCapacity(s, 4ull)) if (!Stream_EnsureRemainingCapacity(s, 4ull))
return FALSE; return FALSE;
Stream_Write_UINT32(s, tz->DaylightBias);
/* DaylightBias defined in windows headers as LONG
* but [MS-RDPBCGR] 2.2.1.11.1.1.1.1 Time Zone Information (TS_TIME_ZONE_INFORMATION) defines it
* as unsigned.... assume the spec is buggy as an unsigned value only works on half of the
* world.
*/
Stream_Write_INT32(s, tz->DaylightBias);
return TRUE; return TRUE;
} }