[vlc-devel] [PATCH] demux/mkv: include dot when checking extensions
Filip Roséen
filip at atch.se
Mon Feb 20 14:54:08 CET 2017
Previously a filename lacking an extension could still pass the check,
for example if a file is found with the name "abc123mkv".
There is also no need to use strncasecmp as
std::basic_string<...>::c_str guarantees that the data referred to by
the return-value is null-terminated.
---
modules/demux/mkv/mkv.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 47e4d3ee61..26c11d5a5f 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -192,8 +192,8 @@ static int Open( vlc_object_t * p_this )
continue; // don't reuse the original opened file
}
- if (!strncasecmp(s_filename.c_str() + s_filename.length() - 3, "mkv", 3) ||
- !strncasecmp(s_filename.c_str() + s_filename.length() - 3, "mka", 3))
+ if (!strcasecmp(s_filename.c_str() + s_filename.length() - 4, ".mkv") ||
+ !strcasecmp(s_filename.c_str() + s_filename.length() - 4, ".mka"))
{
// test whether this file belongs to our family
const uint8_t *p_peek;
--
2.11.1
More information about the vlc-devel
mailing list