[MPlayer-cvslog] CVS: main/libmpdemux demux_ty.c,1.16,1.17

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Mar 9 23:28:12 CET 2006


Hi,
On Thu, Mar 09, 2006 at 05:16:49PM -0500, Rich Felker wrote:
> On Wed, Mar 08, 2006 at 10:13:19PM +0100, Reimar Döffinger CVS wrote:
> > -   char    name[ 80 ];
> > +   char    name[ 100 ];
> >     char    sizestr[ 80 ];
> >     int     size;
> >     int     count;
> > @@ -201,8 +201,8 @@
> >           error = 1;
> >           break;
> >        }
> > -      strncpy( name, &header[ 0 ], 100 );
> > -      strncpy( sizestr, &header[ 124 ], 12 );
> > +      strlcpy( name, &header[ 0 ], 100 );
> > +      strlcpy( sizestr, &header[ 124 ], 12 );
> 
> s/100/sizeof name/
> etc.
> Makes code more robust against changes and readable.

I though of that, but decided it is a bad idea. I assumed that 100 is
the length of the data part in the header. Also it would be confusing to
use sizeof here but not for sizestr. The "correct" solution would
probably be a define. Feel free to improve the code as much as you want
though ;-).

Greetings,
Reimar Döffinger




More information about the MPlayer-cvslog mailing list