Module Name:    src
Committed By:   christos
Date:           Tue Jun 13 13:10:32 UTC 2017

Modified Files:
        src/usr.bin/find: function.c

Log Message:
PR/52295: Anthony Mallet: find -delete: "relative path not safe" with absolute
paths ... Fix from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.75 src/usr.bin/find/function.c:1.76
--- src/usr.bin/find/function.c:1.75	Sun Jun 12 22:06:44 2016
+++ src/usr.bin/find/function.c	Tue Jun 13 09:10:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $	*/
+/*	$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $");
+__RCSID("$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -465,7 +465,7 @@ f_delete(PLAN *plan __unused, FTSENT *en
 		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_level > 0 && strchr(entry->fts_accpath, '/') != NULL)
 		errx(1, "-delete: %s: relative path potentially not safe",
 			entry->fts_accpath);
 

Reply via email to