src/gui/movieplayer.cpp fix possible stack-buffer-overflow

This commit is contained in:
Jacek Jendrzej
2016-03-01 16:11:10 +01:00
parent 6a38042071
commit 0857bf579a

View File

@@ -2307,12 +2307,13 @@ void CMoviePlayerGui::parsePlaylist(CFile *file)
while (infile.good()) while (infile.good())
{ {
infile.getline(cLine, sizeof(cLine)); infile.getline(cLine, sizeof(cLine));
if (cLine[strlen(cLine)-1]=='\r') size_t len = strlen(cLine);
cLine[strlen(cLine)-1]=0; if (len > 0 && cLine[len-1]=='\r')
cLine[len-1]=0;
int dur; int dur;
sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name);
if (strlen(cLine) > 0 && cLine[0]!='#') if (len > 0 && cLine[0]!='#')
{ {
char *url = NULL; char *url = NULL;
if ((url = strstr(cLine, "http://")) || (url = strstr(cLine, "https://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) || (url = strstr(cLine, "mmsh://")) ) { if ((url = strstr(cLine, "http://")) || (url = strstr(cLine, "https://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) || (url = strstr(cLine, "mmsh://")) ) {