summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2014-12-20 13:09:22 +0100
committerThomas Jarosch <tomj@simonv.com>2014-12-20 13:14:19 +0100
commitf8d9e9cb6c4cbec8a611f871de006608ad7a1dbd (patch)
tree07b8e7b97c81470c710fd408603f688c8946beab /apps/playlist.c
parent2caf8870afd844c1368d21b98b3d1e4c0ee8bf10 (diff)
downloadrockbox-f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd.tar.gz
rockbox-f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd.tar.bz2
rockbox-f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd.zip
m3u playlist parser: Check size limit before using buffer
This should only be a problem if the last line is not terminated by \r or \n though. cppcheck reported: [rockbox/apps/playlist.c:234]: (style) Array index 'i' is used before limits check. Change-Id: I8182b66272ba9c024984c81588bd2a6dbb8255b8
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index db93344ef1..173d445f8c 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -231,7 +231,7 @@ static int convert_m3u(char* buf, int buf_len, int buf_max, char* temp)
char* dest;
/* Locate EOL. */
- while ((buf[i] != '\n') && (buf[i] != '\r') && (i < buf_len))
+ while ((i < buf_len) && (buf[i] != '\n') && (buf[i] != '\r'))
{
i++;
}