From 15a5f9ca95755bbe22214086d5ec31fe0689842f Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Fri, 18 Feb 2011 21:39:59 +0000 Subject: 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 --- apps/playlist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps') 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