1
0
Fork 0
forked from len0rd/rockbox

File rename wrongly accepted an empty target filename, corrupting the file system

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6468 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-05-13 10:35:32 +00:00
parent 2b1e168453
commit 263068c6cd

View file

@ -355,7 +355,7 @@ static bool rename_file(void)
int pathlen = (ptr - selected_file);
strncpy(newname, selected_file, sizeof newname);
if (!kbd_input(newname + pathlen, (sizeof newname)-pathlen)) {
if (!strlen(selected_file+pathlen) ||
if (!strlen(newname + pathlen) ||
(rename(selected_file, newname) < 0)) {
lcd_clear_display();
lcd_puts(0,0,str(LANG_RENAME));