changeset 30458:f6721168aee8

Replace incorrect usage of strncpy.
author reimar
date Wed, 03 Feb 2010 22:36:47 +0000
parents 04bdf393175b
children 9bb2ebbb52be
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Wed Feb 03 22:33:35 2010 +0000
+++ b/libmpdemux/demux_lavf.c	Wed Feb 03 22:36:47 2010 +0000
@@ -37,6 +37,7 @@
 #include "libavformat/avformat.h"
 #include "libavformat/avio.h"
 #include "libavutil/avutil.h"
+#include "libavutil/avstring.h"
 #include "libavcodec/opt.h"
 
 #include "mp_taglists.h"
@@ -462,11 +463,11 @@
 
     if(demuxer->stream->url) {
         if (!strncmp(demuxer->stream->url, "ffmpeg://rtsp:", 14))
-            strncpy(mp_filename, demuxer->stream->url + 9, sizeof(mp_filename)-3);
+            av_strlcpy(mp_filename, demuxer->stream->url + 9, sizeof(mp_filename));
         else
-            strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
+            av_strlcat(mp_filename, demuxer->stream->url, sizeof(mp_filename));
     } else
-        strncpy(mp_filename + 3, "foobar.dummy", sizeof(mp_filename)-3);
+        av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename));
 
     priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0,
                                  demuxer->stream, mp_read, NULL, mp_seek);