• Status New
  • Percent Complete
  • Task Type Bugs
  • Category Applications
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by jdgordon - 2008-08-10

FS#9260 - r18234 - core + plugins shouldnt be calling opendir() directly...

Only filetree.c should be allowed to call opendir(), anything that needs to recursively scan directories should be calling ft_load() which can smartly open, scan and close a directory.

The problem with this is that the filename buffer could get corrupted easily if its misused.

as of r18234 the following is using opendir() in the core
filetree.c:133: dir = opendir(c→currdir); ← not recursive
filetree.c:257: dir = opendir(tempdir); ← in ft_load() so ok
filetree.c:259: dir = opendir(c→currdir); ← “” “” “” misc.c:164: dir = opendir(pathlen ? buffer : “/”);
misc.c:1059: dir = opendir(BOOTDIR);
misc.c:1142: DIR* d = opendir(path);
onplay.c:466: dir = opendir(dirname);
onplay.c:817: srcdir = opendir(src);
tagcache.c:4075: dir = opendir(dirname);

the tagcache and the onplay.c ones are dangerous… the 3 in misc.c are not recursive so safe.

the following are uses in plugins, havnt checked them so I only know for sure that stats, disktidy and properties are unsafe
plugins/disktidy.c:203: dir = rb→opendir(name);
plugins/disktidy.c:270: dir = rb→opendir(name);
plugins/md5sum.c:78: dir = rb→opendir( path );
plugins/md5sum.c:113: DIR *dir = rb→opendir( newpath );
plugins/md5sum.c:209: dir = rb→opendir( arg );
plugins/properties.c:79: dir = rb→opendir(tstr);
plugins/properties.c:151: dir = rb→opendir(dps→dirname);
plugins/properties.c:276: dir = rb→opendir(str_dirname);
plugins/random_folder_advance_config.c:70: dir = rb→opendir(fullpath);
plugins/random_folder_advance_config.c:165: dir_check = rb→opendir(formatted_line);
plugins/rockpaint.c:740: d = rb→opendir( bbuf );
plugins/rockpaint.c:754: d = rb→opendir( “/” );
plugins/rockpaint.c:915: d = rb→opendir( FONT_DIR “/” );
plugins/sokoban.c:925: if(!(dir = rb→opendir(dirname)))
plugins/stats.c:139: dir = rb→opendir(fullpath);
plugins/test_codec.c:763: dir = rb→opendir(dirpath);
plugins/test_disk.c:356: dir = rb→opendir(testbasedir);
plugins/test_disk.c:359: rb→splash(HZ, “opendir() failed.”);
plugins/test_disk.c:421: if 1) == NULL)
plugins/wavrecord.c:3774: if 2) == NULL)

The bad calls in the core should be changed to use ft_load, and the plugins should either get a new function in the lib to grab some ram and manage the whole thing, or maybe its safe to just call ft_load there also?

or alternatively, we can go on ignoring the issue.

1) dir = rb→opendir(testbasedir
2) dir = rb→opendir(recbasedir


Available keyboard shortcuts


Task Details

Task Editing