[vlc-commits] ogg: fix stringop-truncation warning

Alexandre Janniaux git at videolan.org
Wed Sep 11 09:44:45 CEST 2019


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Sep  5 12:53:02 2019 +0200| [d9d13ad4d92ed13f912be995a5ec0c20e4a8c123] | committer: Thomas Guillem

ogg: fix stringop-truncation warning

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/mux/ogg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index 82e5e90aa2..c03e5355b7 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -499,10 +499,11 @@ 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 );
             char buf[5];
+            memset( buf, 0, sizeof(buf) );
             snprintf( buf, sizeof(buf), "%"PRIx16, i_tag );
-            strncpy( p_stream->p_oggds_header->sub_type, buf, 4 );
+
+            memcpy( p_stream->p_oggds_header->sub_type, buf, 4 );
 
             p_stream->p_oggds_header->i_time_unit = MSFTIME_FROM_SEC(1);
             p_stream->p_oggds_header->i_default_len = 1;



More information about the vlc-commits mailing list