Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/find PR/52295: Anthony Mallet: find -delete: "relati...



details:   https://anonhg.NetBSD.org/src/rev/9f637533f9fe
branches:  trunk
changeset: 824658:9f637533f9fe
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 13 13:10:32 2017 +0000

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

diffstat:

 usr.bin/find/function.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 014f564424ff -r 9f637533f9fe usr.bin/find/function.c
--- a/usr.bin/find/function.c   Tue Jun 13 09:37:22 2017 +0000
+++ b/usr.bin/find/function.c   Tue Jun 13 13:10:32 2017 +0000
@@ -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 @@
                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);
 



Home | Main Index | Thread Index | Old Index