diff options
author | Thomas Jarosch <tomj@simonv.com> | 2011-02-18 21:39:59 +0000 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2011-02-18 21:39:59 +0000 |
commit | 15a5f9ca95755bbe22214086d5ec31fe0689842f (patch) | |
tree | 040a58997c255d3155bb1a5d463e888508bc33dc /apps/playlist.c | |
parent | 84fccff17070ba78764ae200c4f38e0a53ff0ce7 (diff) | |
download | rockbox-15a5f9ca95755bbe22214086d5ec31fe0689842f.tar.gz rockbox-15a5f9ca95755bbe22214086d5ec31fe0689842f.tar.bz2 rockbox-15a5f9ca95755bbe22214086d5ec31fe0689842f.zip |
Don't underflow the buffer in format_track_path() if it consists of whitespaces
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29325 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 3bbe8b2f99..aa53ef9a49 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1666,12 +1666,13 @@ static int format_track_path(char *dest, char *src, int buf_length, int max, i++; /* Now work back killing white space */ - while((src[i-1] == ' ') || - (src[i-1] == '\t')) + while((i > 0) && + ((src[i-1] == ' ') || + (src[i-1] == '\t'))) i--; src[i]=0; - + /* replace backslashes with forward slashes */ for ( j=0; j<i; j++ ) if ( src[j] == '\\' ) |