libfreerdp-core: sanitize NSCodec capabilities
This commit is contained in:
parent
ab9a4318c8
commit
d6e6db05e9
@ -2818,14 +2818,28 @@ void rdp_write_rfx_client_capability_container(wStream* s, rdpSettings* settings
|
||||
*/
|
||||
void rdp_write_nsc_client_capability_container(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
BYTE colorLossLevel;
|
||||
BYTE fAllowSubsampling;
|
||||
BYTE fAllowDynamicFidelity;
|
||||
|
||||
fAllowDynamicFidelity = settings->NSCodecAllowDynamicColorFidelity;
|
||||
fAllowSubsampling = settings->NSCodecAllowSubsampling;
|
||||
colorLossLevel = settings->NSCodecColorLossLevel;
|
||||
|
||||
if (colorLossLevel < 1)
|
||||
colorLossLevel = 1;
|
||||
|
||||
if (colorLossLevel > 7)
|
||||
colorLossLevel = 7;
|
||||
|
||||
Stream_EnsureRemainingCapacity(s, 8);
|
||||
|
||||
Stream_Write_UINT16(s, 3); /* codecPropertiesLength */
|
||||
|
||||
/* TS_NSCODEC_CAPABILITYSET */
|
||||
Stream_Write_UINT8(s, settings->NSCodecAllowDynamicColorFidelity); /* fAllowDynamicFidelity */
|
||||
Stream_Write_UINT8(s, settings->NSCodecAllowSubsampling); /* fAllowSubsampling */
|
||||
Stream_Write_UINT8(s, settings->NSCodecColorLossLevel); /* colorLossLevel */
|
||||
Stream_Write_UINT8(s, fAllowDynamicFidelity); /* fAllowDynamicFidelity (1 byte) */
|
||||
Stream_Write_UINT8(s, fAllowSubsampling); /* fAllowSubsampling (1 byte) */
|
||||
Stream_Write_UINT8(s, colorLossLevel); /* colorLossLevel (1 byte) */
|
||||
}
|
||||
|
||||
void rdp_write_jpeg_client_capability_container(wStream* s, rdpSettings* settings)
|
||||
|
Loading…
Reference in New Issue
Block a user