Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Nov 2008 02:04:59 GMT
From:      James Vega <vega.james@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/128933: realpath(3) does not follow SUS specification for a NULL/empty path
Message-ID:  <200811170204.mAH24xkw015323@www.freebsd.org>
Resent-Message-ID: <200811170210.mAH2A2xm039304@freefall.freebsd.org>

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

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811170204.mAH24xkw015323>