[vlc-devel] commit: Avoid sprintf. (Laurent Aimar )

git version control git at videolan.org
Wed Jan 7 20:29:35 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jan  6 22:05:08 2009 +0100| [fd453018ed7acfe2fb6c1a84384b1b0087c12df9] | committer: Laurent Aimar 

Avoid sprintf.

It eases security review.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fd453018ed7acfe2fb6c1a84384b1b0087c12df9
---

 modules/demux/avi/avi.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index caf9828..3321cdf 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -339,11 +339,11 @@ static int Open( vlc_object_t * p_this )
     if( ( p_sys->meta = vlc_meta_New() ) )
     {
         char buffer[200];
-        sprintf( buffer, "%s%s%s%s",
-                 p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
-                 p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
-                 p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
-                 p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
+        snprintf( buffer, sizeof(buffer), "%s%s%s%s",
+                  p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
+                  p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
+                  p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
+                  p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
         vlc_meta_SetSetting( p_sys->meta, buffer );
     }
 




More information about the vlc-devel mailing list