[core] fix clientInfo with both dynamicTimeZone and reconnect cookie

The ClientInfo packet was wrongly forged when we had dynamic timezone and a
reconnect cookie (reserved fields written twice).
This commit is contained in:
David Fort 2024-05-22 19:09:05 +02:00
parent 6ebb0889d9
commit 3147df8486
1 changed files with 5 additions and 10 deletions

View File

@ -545,8 +545,8 @@ static BOOL rdp_write_extended_info_packet(rdpRdp* rdp, wStream* s)
if (!Stream_EnsureRemainingCapacity(s, 10ull))
goto fail;
Stream_Write_UINT32(
s, settings->ClientSessionId); /* clientSessionId (4 bytes), should be set to 0 */
/* clientSessionId (4 bytes), should be set to 0 */
Stream_Write_UINT32(s, settings->ClientSessionId);
freerdp_performance_flags_make(settings);
Stream_Write_UINT32(s, settings->PerformanceFlags); /* performanceFlags (4 bytes) */
Stream_Write_UINT16(s, cbAutoReconnectCookie); /* cbAutoReconnectCookie (2 bytes) */
@ -557,20 +557,15 @@ static BOOL rdp_write_extended_info_packet(rdpRdp* rdp, wStream* s)
goto fail;
if (!rdp_write_client_auto_reconnect_cookie(rdp, s)) /* autoReconnectCookie */
goto fail;
if (!Stream_EnsureRemainingCapacity(s, 4ull))
goto fail;
Stream_Write_UINT16(s, 0); /* reserved1 (2 bytes) */
Stream_Write_UINT16(s, 0); /* reserved2 (2 bytes) */
}
if (freerdp_settings_get_bool(settings, FreeRDP_SupportDynamicTimeZone))
{
if (!Stream_EnsureRemainingCapacity(s, 10 + 254 * sizeof(WCHAR)))
if (!Stream_EnsureRemainingCapacity(s, 8 + 254 * sizeof(WCHAR)))
goto fail;
/* skip reserved1 and reserved2 fields */
Stream_Seek(s, 4);
Stream_Write_UINT16(s, 0); /* reserved1 (2 bytes) */
Stream_Write_UINT16(s, 0); /* reserved2 (2 bytes) */
size_t rlen = 0;
const char* tz = freerdp_settings_get_string(settings, FreeRDP_DynamicDSTTimeZoneKeyName);