[vlc-commits] Ogg: fix off-by-one overflow

Rémi Denis-Courmont git at videolan.org
Sat Jun 4 21:10:41 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  4 22:10:15 2011 +0300| [b38b9c24c20313bfa3fa76fe7dffa6177edd270e] | committer: Rémi Denis-Courmont

Ogg: fix off-by-one overflow

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

 modules/mux/ogg.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index 044ddc7..b02c1ed 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -416,7 +416,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             memcpy( p_stream->p_oggds_header->stream_type, "audio", 5 );
 
             memset( p_stream->p_oggds_header->sub_type, 0, 4 );
-            sprintf( p_stream->p_oggds_header->sub_type, "%-x", i_tag );
+            char buf[5];
+            snprintf( buf, sizeof(buf), "%"PRIx16, i_tag );
+            strncpy( p_stream->p_oggds_header->sub_type, buf, 4 );
 
             SetQWLE( &p_stream->p_oggds_header->i_time_unit, INT64_C(10000000) );
             SetDWLE( &p_stream->p_oggds_header->i_default_len, 1 );



More information about the vlc-commits mailing list