Commit 7fe2841f authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Fixed potential out of bound reads in DASH probe function.

(cherry picked from commit 65bd21f9ac1070cb308166c9b468f157a394bd56)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 83d10ccf
...@@ -143,13 +143,13 @@ Profile DOMParser::getProfile (dash::xml::Node *node) ...@@ -143,13 +143,13 @@ Profile DOMParser::getProfile (dash::xml::Node *node)
} }
bool DOMParser::isDash (stream_t *stream) bool DOMParser::isDash (stream_t *stream)
{ {
const uint8_t *peek;
const char* psz_namespace = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011"; 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;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment