Fix format-detection by Robert Sanders

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@491 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2003-10-14 07:46:49 +00:00
parent 5d67a3e036
commit 9ba4716057
2 changed files with 15 additions and 0 deletions

View File

@ -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++;

View File

@ -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 */