From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 21 02:20:03 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A07941065673 for ; Sun, 21 Mar 2010 02:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 63A498FC17 for ; Sun, 21 Mar 2010 02:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o2L2K1u4045246 for ; Sun, 21 Mar 2010 02:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2L2K1Ge045245; Sun, 21 Mar 2010 02:20:01 GMT (envelope-from gnats) Resent-Date: Sun, 21 Mar 2010 02:20:01 GMT Resent-Message-Id: <201003210220.o2L2K1Ge045245@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21341106564A for ; Sun, 21 Mar 2010 02:13:01 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 108168FC12 for ; Sun, 21 Mar 2010 02:13:01 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2L2D0tk089548 for ; Sun, 21 Mar 2010 02:13:00 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o2L2D0xC089547; Sun, 21 Mar 2010 02:13:00 GMT (envelope-from nobody) Message-Id: <201003210213.o2L2D0xC089547@www.freebsd.org> Date: Sun, 21 Mar 2010 02:13:00 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/144921: [patch] [pkg_install] Replace vsystem'ed call to mkdir(1) in add/futil.c with mkdir(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2010 02:20:03 -0000 >Number: 144921 >Category: bin >Synopsis: [patch] [pkg_install] Replace vsystem'ed call to mkdir(1) in add/futil.c with mkdir(1) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Mar 21 02:20:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9-CURRENT >Organization: Cisco Systems, Inc. >Environment: >Description: There's no reason why we should expose the end-user to potential security issues in creating a subshell, or incur the unnecessary overhead of using mkdir(1) via vsystem when we can use mkdir(2) instead. >How-To-Repeat: >Fix: See patch. Patch attached with submission follows: ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/add/futil.c#1 - /scratch/freebsd/perforce/pkg_install-enhancements/usr.sbin/pkg_install/add/futil.c ==== @@ -50,7 +50,7 @@ } } else { - if (vsystem("/bin/mkdir %s", dir)) { + if (mkdir(dir, 0700) < 0) { if (cp2) *cp2 = '/'; return FAIL; >Release-Note: >Audit-Trail: >Unformatted: