summaryrefslogtreecommitdiff
path: root/apps
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
parent15a5f9ca95755bbe22214086d5ec31fe0689842f (diff)
downloadrockbox-3926c30705cc7235122e2f2e35ab506b53238cdf.tar.gz
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')
-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,
1659 int j; 1659 int j;
1660 char *temp_ptr; 1660 char *temp_ptr;
1661 1661
1662 /* Zero-terminate the file name */ 1662 /* Look for the end of the string */
1663 while((i < max) && 1663 while((i < max) &&
1664 (src[i] != '\n') && 1664 (src[i] != '\n') &&
1665 (src[i] != '\r')) 1665 (src[i] != '\r') &&
1666 (src[i] != '\0'))
1666 i++; 1667 i++;
1667 1668
1668 /* Now work back killing white space */ 1669 /* Now work back killing white space */
@@ -1671,6 +1672,7 @@ static int format_track_path(char *dest, char *src, int buf_length, int max,
1671 (src[i-1] == '\t'))) 1672 (src[i-1] == '\t')))
1672 i--; 1673 i--;
1673 1674
1675 /* Zero-terminate the file name */
1674 src[i]=0; 1676 src[i]=0;
1675 1677
1676 /* replace backslashes with forward slashes */ 1678 /* replace backslashes with forward slashes */