From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 17 02:10:03 2008 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 0FFA3106567A for ; Mon, 17 Nov 2008 02:10: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 E0CD38FC16 for ; Mon, 17 Nov 2008 02:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH2A2Xl039305 for ; Mon, 17 Nov 2008 02:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mAH2A2xm039304; Mon, 17 Nov 2008 02:10:02 GMT (envelope-from gnats) Resent-Date: Mon, 17 Nov 2008 02:10:02 GMT Resent-Message-Id: <200811170210.mAH2A2xm039304@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, James Vega Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C420106567A for ; Mon, 17 Nov 2008 02:05:00 +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 EF65D8FC1C for ; Mon, 17 Nov 2008 02:04:59 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mAH24xX0015329 for ; Mon, 17 Nov 2008 02:04:59 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id mAH24xkw015323; Mon, 17 Nov 2008 02:04:59 GMT (envelope-from nobody) Message-Id: <200811170204.mAH24xkw015323@www.freebsd.org> Date: Mon, 17 Nov 2008 02:04:59 GMT From: James Vega To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/128933: realpath(3) does not follow SUS specification for a NULL/empty path 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: Mon, 17 Nov 2008 02:10:03 -0000 >Number: 128933 >Category: kern >Synopsis: realpath(3) does not follow SUS specification for a NULL/empty path >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 17 02:10:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: James Vega >Release: >Organization: >Environment: >Description: According to the Single Unix Specification[0], the realpath stdlib function should return NULL (to indicate an error) when the first argument to realpath is either NULL or an empty string and set errno to EINVAL/ENOENT respectively. For the empty string case, FreeBSD is currently populating resolved with the current working directory and returning the pointer to that. For the NULL case, I see no check whether path is NULL or not. Instead, the first use of it is dereferencing the pointer if (path[0] == '/' [0] - http://www.opengroup.org/onlinepubs/009695399/functions/realpath.html >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: