Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2003 23:22:11 -0500
From:      arlankfo@141.com
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/48271: bug with find's -delete option
Message-ID:  <20030214042220.SJRH25811.out008.verizon.net@verizon.net>

next in thread | raw e-mail | index | archive | help


>Number:         48271
>Category:       bin
>Synopsis:       bug with find's -delete option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 13 20:30:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Lankford
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD bogushost2 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Thu Feb 13 20:27:55 EST 2003 root@bogushost2:/usr/obj/usr/src/sys/ARL5KERNEL i386

>Description:
Find's -delete option incorrectly checks for relative pathnames.

>How-To-Repeat:

	# cd /

	# mkdir testdir

	# mkdir testdir/testdir2

	# find /testdir -delete
	find: -delete: /testdir: relative path potentially not safe

>Fix:

--- /usr/src/usr.bin/find/function.c	2003/02/13 06:42:07	1.1
+++ /usr/src/usr.bin/find/function.c	2003/02/13 07:14:57
@@ -395,7 +395,7 @@
 		errx(1, "-delete: insecure options got turned on");
 
 	/* Potentially unsafe - do not accept relative paths whatsoever */
-	if (strchr(entry->fts_accpath, '/') != NULL)
+	if (*(entry->fts_accpath) != '/')
 		errx(1, "-delete: %s: relative path potentially not safe",
 			entry->fts_accpath);

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030214042220.SJRH25811.out008.verizon.net>