From 0857bf579a829a559859d13654af3e474d00fb09 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 1 Mar 2016 16:11:10 +0100 Subject: [PATCH] src/gui/movieplayer.cpp fix possible stack-buffer-overflow --- src/gui/movieplayer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 9dea03794..c8ce5df13 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2307,12 +2307,13 @@ void CMoviePlayerGui::parsePlaylist(CFile *file) while (infile.good()) { infile.getline(cLine, sizeof(cLine)); - if (cLine[strlen(cLine)-1]=='\r') - cLine[strlen(cLine)-1]=0; + size_t len = strlen(cLine); + if (len > 0 && cLine[len-1]=='\r') + cLine[len-1]=0; int dur; sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); - if (strlen(cLine) > 0 && cLine[0]!='#') + if (len > 0 && cLine[0]!='#') { char *url = NULL; if ((url = strstr(cLine, "http://")) || (url = strstr(cLine, "https://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) || (url = strstr(cLine, "mmsh://")) ) {