BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001320 [BusyBox] Documentation minor always 04-20-07 02:12 04-21-07 16:13
Reporter rockeychu View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0001320: Patch for "libbb/find_root_device.c" to solve possible of endless loop
Description libbb/find_root_device.c REV 18435 introduced a potential bug, which could cause 'df' hung, such as when '/dev/fd' is symlink of '/proc/self/fd'.
Symbolic link device is very dangerous when dealing with /dev/ subdir (it may point to itself), so just omit it.

Patch as following:

Index: libbb/find_root_device.c
===================================================================
--- libbb/find_root_device.c (revision 18501)
+++ libbb/find_root_device.c (working copy)
@@ -41,12 +41,14 @@

        while ((entry = readdir(dir)) != NULL) {
                safe_strncpy(ap->devpath + len, entry->d_name, rem);
- if (stat(ap->devpath, &ap->st) != 0)
+ if (lstat(ap->devpath, &ap->st) != 0)
                        continue;
                if (S_ISBLK(ap->st.st_mode) && ap->st.st_rdev == ap->dev) {
                        retpath = xstrdup(ap->devpath);
                        break;
                }
+ if (S_ISLNK(ap->st.st_mode))
+ continue;
                if (S_ISDIR(ap->st.st_mode)) {
                        /* Do not recurse for '.' and '..' */
                        if (DOT_OR_DOTDOT(entry->d_name))
Additional Information
Attached Files

- Relationships

- Notes
(0002327)
vda
04-21-07 16:13

Fixed in svn, thanks! (ISLNK check is not needed, thus not added)
 

- Issue History
Date Modified Username Field Change
04-20-07 02:12 rockeychu New Issue
04-20-07 02:12 rockeychu Status new => assigned
04-20-07 02:12 rockeychu Assigned To  => BusyBox
04-21-07 16:13 vda Status assigned => closed
04-21-07 16:13 vda Note Added: 0002327
04-21-07 16:13 vda Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker