changeset 12213:064cb156d2b7

10l to me: writing outside allocated memory Patch by Mikulas Patocka < mikulas (at) artax (dot) karlin (dot) mff (dot) cuni (dot) cz>
author rtognimp
date Thu, 15 Apr 2004 20:48:27 +0000
parents 2e8b305586a0
children d6849f80c132
files libmpdemux/demux_audio.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Thu Apr 15 18:19:39 2004 +0000
+++ b/libmpdemux/demux_audio.c	Thu Apr 15 20:48:27 2004 +0000
@@ -168,7 +168,7 @@
       free_sh_audio(sh_audio);
       return 0;
     }
-    sh_audio->wf = w = (WAVEFORMATEX*)malloc(l);
+    sh_audio->wf = w = (WAVEFORMATEX*)malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
     w->wFormatTag = sh_audio->format = stream_read_word_le(s);
     w->nChannels = sh_audio->channels = stream_read_word_le(s);
     w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);