mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
15a5f9ca95
commit
3926c30705
1 changed files with 4 additions and 2 deletions
|
@ -1659,10 +1659,11 @@ static int format_track_path(char *dest, char *src, int buf_length, int max,
|
||||||
int j;
|
int j;
|
||||||
char *temp_ptr;
|
char *temp_ptr;
|
||||||
|
|
||||||
/* Zero-terminate the file name */
|
/* Look for the end of the string */
|
||||||
while((i < max) &&
|
while((i < max) &&
|
||||||
(src[i] != '\n') &&
|
(src[i] != '\n') &&
|
||||||
(src[i] != '\r'))
|
(src[i] != '\r') &&
|
||||||
|
(src[i] != '\0'))
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
/* Now work back killing white space */
|
/* 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')))
|
(src[i-1] == '\t')))
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
|
/* Zero-terminate the file name */
|
||||||
src[i]=0;
|
src[i]=0;
|
||||||
|
|
||||||
/* replace backslashes with forward slashes */
|
/* replace backslashes with forward slashes */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue