[vlc-commits] demux/mkv: include dot when checking extensions for linked-files

Filip Roséen git at videolan.org
Tue Feb 21 13:54:03 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Feb 20 14:54:08 2017 +0100| [ca194ade430db66e39e025cb06f46a3cc7ee4b4e] | committer: Jean-Baptiste Kempf

demux/mkv: include dot when checking extensions for linked-files

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.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 1319b49..8fc2132 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;



More information about the vlc-commits mailing list