__int64 __usercall mstscax!CRDPSound::vcwaveChooseSoundFormat( CRDPSound *rdpsnd, struct SNDFORMATITEM *snd_formats, struct SNDFORMATITEM **mem_ptr, unsigned int wNumberOfSoundFormats, unsigned int *size_ptr, unsigned int *size_ptr_) { // ... if (wNumberOfSoundFormats) { // ... if (total_size) { client_snd_formats = (struct SNDFORMATITEM *)malloc(total_size); // the code below added in the patched version // memset(client_snd_formats, 0, total_size); if (client_snd_formats) { do { // when not patched // with snd_formats->nAvgBytesPerSc == 0, // there are uninitialized memories if (snd_formats->nAvgBytesPerSec) { memcpy(client_snd_formats, snd_formats, snd_formats->cbSize + SND_FORMAT_HEADER_SIZE); client_snd_formats = (struct SNDFORMATITEM *)(client_snd_formats + snd_formats->cbSize + SND_FORMAT_HEADER_SIZE); } --wNumberOfSoundFormats; snd_formats = (struct SNDFORMATITEM *)(snd_formats + snd_formats->cbSize + SND_FORMAT_HEADER_SIZE); } while (wNumberOfSoundFormats); } } } // ... }