summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-06-15 19:58:11 +0200
committerAnton Khirnov <anton@khirnov.net>2012-06-16 17:09:33 +0200
commita5db8e4a1a5449cc7a61e963c9fa698a4f22131b (patch)
treee9d614a14849eb70f1b4d3869b1e0a47d1304535 /libavformat
parentfbc57405664876cb7f47f1ac264db16a3014e665 (diff)
lavf: don't segfault when a NULL filename is passed to avformat_open_input()
This can easily happen when the caller is using a custom AVIOContext. Behave as if the filename was an empty string in this case. CC: libav-stable@libav.org
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d7ba5a7405..5450dc4bff 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -557,7 +557,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
}
s->duration = s->start_time = AV_NOPTS_VALUE;
- av_strlcpy(s->filename, filename, sizeof(s->filename));
+ av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
/* allocate private data */
if (s->iformat->priv_data_size > 0) {