diff --git a/rdpsnd.c b/rdpsnd.c index 41e1b2d..a26bace 100644 --- a/rdpsnd.c +++ b/rdpsnd.c @@ -104,6 +104,18 @@ rdpsnd_process_negotiate(STREAM in) in_uint16_le(in, format->wBitsPerSample); in_uint16_le(in, format->cbSize); + /* read in the buffer of unknown use */ + int readcnt = format->cbSize; + int discardcnt = 0; + if (format->cbSize > MAX_CBSIZE) + { + fprintf(stderr, "cbSize too large for buffer: %d\n", format->cbSize); + readcnt = MAX_CBSIZE; + discardcnt = format->cbSize - MAX_CBSIZE; + } + in_uint8a(in, format->cb, readcnt); + in_uint8s(in, discardcnt); + if (device_available && wave_out_format_supported(format)) { format_count++; diff --git a/types.h b/types.h index 60c5098..04e8120 100644 --- a/types.h +++ b/types.h @@ -119,6 +119,8 @@ typedef struct _VCHANNEL } VCHANNEL; +#define MAX_CBSIZE 256 + /* RDPSND */ typedef struct { uint16 wFormatTag; @@ -128,6 +130,7 @@ typedef struct { uint16 nBlockAlign; uint16 wBitsPerSample; uint16 cbSize; + uint8 cb[MAX_CBSIZE]; } WAVEFORMATEX; /* RDPDR */