summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-02-18 21:56:48 +0000
committerThomas Jarosch <tomj@simonv.com>2011-02-18 21:56:48 +0000
commit3926c30705cc7235122e2f2e35ab506b53238cdf (patch)
tree1a214f6edf29efede1eb5de1a4a860150189b81e /apps/playlist.c
parent15a5f9ca95755bbe22214086d5ec31fe0689842f (diff)
downloadrockbox-3926c30705cc7235122e2f2e35ab506b53238cdf.tar.gz
rockbox-3926c30705cc7235122e2f2e35ab506b53238cdf.tar.bz2
rockbox-3926c30705cc7235122e2f2e35ab506b53238cdf.zip
Make sure we don't read past the end of a C-string in format_track_path. Second part of FS #11947
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29326 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index aa53ef9a49..bbbbe22349 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1659,10 +1659,11 @@ static int format_track_path(char *dest, char *src, int buf_length, int max,
int j;
char *temp_ptr;
- /* Zero-terminate the file name */
+ /* Look for the end of the string */
while((i < max) &&
(src[i] != '\n') &&
- (src[i] != '\r'))
+ (src[i] != '\r') &&
+ (src[i] != '\0'))
i++;
/* Now work back killing white space */
@@ -1671,6 +1672,7 @@ static int format_track_path(char *dest, char *src, int buf_length, int max,
(src[i-1] == '\t')))
i--;
+ /* Zero-terminate the file name */
src[i]=0;
/* replace backslashes with forward slashes */