From f8d9e9cb6c4cbec8a611f871de006608ad7a1dbd Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Sat, 20 Dec 2014 13:09:22 +0100 Subject: 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 --- apps/playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++; } -- cgit v1.2.3