kern/128933: realpath(3) does not follow SUS specification for a NULL/empty path

James Vega vega.james at gmail.com
Sun Nov 16 18:10:03 PST 2008


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


More information about the freebsd-bugs mailing list