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

Rich Felker dalias at aerifal.cx
Thu Mar 9 23:16:49 CET 2006


On Wed, Mar 08, 2006 at 10:13:19PM +0100, Reimar Döffinger CVS wrote:
> CVS change done by Reimar Döffinger CVS
> 
> Update of /cvsroot/mplayer/main/libmpdemux
> In directory mail:/var2/tmp/cvs-serv27990
> 
> Modified Files:
> 	demux_ty.c 
> Log Message:
> name array is too small, use strlcpy instead of strncpy
> 
> 
> Index: demux_ty.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ty.c,v
> retrieving revision 1.16
> retrieving revision 1.17
> diff -u -r1.16 -r1.17
> --- demux_ty.c	17 Feb 2006 01:57:41 -0000	1.16
> +++ demux_ty.c	8 Mar 2006 21:13:16 -0000	1.17
> @@ -158,7 +158,7 @@
>  int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
>  {
>     char    header[ 512 ];
> -   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.

Rich




More information about the MPlayer-cvslog mailing list