[BusyBox 0001320]: Patch for "libbb/find_root_device.c" to solve possible of endless loop
bugs at busybox.net
bugs at busybox.net
Sat Apr 21 23:13:14 UTC 2007
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=1320
======================================================================
Reported By: rockeychu
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1320
Category: Documentation
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 04-20-2007 02:12 PDT
Last Modified: 04-21-2007 16:13 PDT
======================================================================
Summary: 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))
======================================================================
----------------------------------------------------------------------
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
======================================================================
More information about the busybox-cvs
mailing list