diff options
author | Thomas Jarosch <tomj@simonv.com> | 2014-12-20 13:09:22 +0100 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2014-12-20 13:14:19 +0100 |
commit | f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd (patch) | |
tree | 07b8e7b97c81470c710fd408603f688c8946beab /apps/playlist.c | |
parent | 2caf8870afd844c1368d21b98b3d1e4c0ee8bf10 (diff) | |
download | rockbox-f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd.tar.gz 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.c | 2 |
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) | |||
231 | char* dest; | 231 | char* dest; |
232 | 232 | ||
233 | /* Locate EOL. */ | 233 | /* Locate EOL. */ |
234 | while ((buf[i] != '\n') && (buf[i] != '\r') && (i < buf_len)) | 234 | while ((i < buf_len) && (buf[i] != '\n') && (buf[i] != '\r')) |
235 | { | 235 | { |
236 | i++; | 236 | i++; |
237 | } | 237 | } |