[vlc-devel] commit: A few sprintf()+n in text/strings.c (JP Dinger )

Laurent Aimar fenrir at via.ecp.fr
Sat May 30 22:43:07 CEST 2009


Hi,

On Sat, May 30, 2009, git version control wrote:
> vlc | branch: master | JP Dinger <jpd at videolan.org> | Sat May 30 22:35:45 2009 +0200| [6d0ff11dec49ae7f335ceed15c6a2e46cddd880d] | committer: JP Dinger 
> 
> A few sprintf()+n in text/strings.c
> 
> -                        sprintf( buf, "%02d:%02d:%02d",
> +                        snprintf( buf, 10, "%02d:%02d:%02d",
>                                   (int)(i_duration/(3600000000)),
>                                   (int)((i_duration/(60000000))%60),
>                                   (int)((i_duration/1000000)%60) );

 When the variable is a local array, I think it's way safer in the long term to
use sizeof(variable).
 If you don't like that, then a const variable holding the size is still better
than a hardcoded size IMHO.

-- 
fenrir



More information about the vlc-devel mailing list