[MPlayer-users] Problem with uncleared buffers in "cue://" handler
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun May 29 12:52:14 CEST 2011
On Sun, May 29, 2011 at 01:45:59PM +0300, Ivan Kalvachev wrote:
> On 5/21/11, Linards Ticmanis <ticmanis at gmx.de> wrote:
> > The function cue_find_bin() in stream/stream_cue.c fails to zero the
> > buffers it uses, which leads to problems with previous memory content
> > messing up the path that is being built. I propose this change to fix
> > the problem:
> >
> >> --- stream/stream_cue.c (revision 33473)
> >> +++ stream/stream_cue.c (working copy)
> >> @@ -179,6 +179,10 @@
> >> char t[256];
> >> int fd_bin;
> >>
> >> + memset(bin_filename, 0, sizeof bin_filename);
> >> + memset(s, 0, sizeof s);
> >> + memset(t, 0, sizeof t);
> >> +
> >> /* get the filename out of that */
> >> /* 12345 6 */
> >> mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline);
> >> (END)
>
> It is recommended to send patches to mplayer-dev-eng maillist.
> I guess you didn't consider your code to be real patch,
> ( sizeof() needs the brackets (/) :)
No it doesn't, though using them would be more consistent with the
rest of the code.
Also since this is not speed-critical, initializers are a simpler
way of achieving this than an explicit memset.
More information about the MPlayer-users
mailing list