[vlc-commits] Fixed potential out of bound reads in DASH probe function.

Laurent Aimar git at videolan.org
Sun Dec 11 20:20:00 CET 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Dec 11 20:03:10 2011 +0100| [65bd21f9ac1070cb308166c9b468f157a394bd56] | committer: Laurent Aimar

Fixed potential out of bound reads in DASH probe function.

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

 modules/stream_filter/dash/xml/DOMParser.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp
index 638a109..f35cab9 100644
--- a/modules/stream_filter/dash/xml/DOMParser.cpp
+++ b/modules/stream_filter/dash/xml/DOMParser.cpp
@@ -143,13 +143,13 @@ Profile DOMParser::getProfile               (dash::xml::Node *node)
 }
 bool    DOMParser::isDash                   (stream_t *stream)
 {
-    const uint8_t *peek;
-
     const char* psz_namespace = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011";
-    if(stream_Peek(stream, &peek, 1024) < (int)strlen(psz_namespace))
-        return false;
 
-    const char *p = strstr((const char*)peek, psz_namespace );
+    const uint8_t *peek;
+    int peek_size = stream_Peek(stream, &peek, 1024);
+    if (peek_size < (int)strlen(psz_namespace))
+        return false;
 
-    return p != NULL;
+    std::string header((const char*)peek, peek_size);
+    return header.find(psz_namespace) != std::string::npos;
 }



More information about the vlc-commits mailing list