NetBSD-Bugs archive

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

lib/42559: realpath(1) doesn't return EINVAL if filename is NULL pointer



>Number:         42559
>Category:       lib
>Synopsis:       realpath(1) doesn't return EINVAL if filename is NULL pointer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 01 12:20:01 +0000 2010
>Originator:     Stathis Kamperis
>Release:        5.0.1
>Organization:
>Environment:
NetBSD 5.0.1 GENERIC kernel / i386
>Description:
Both issue 6 and 7 require that realpath() will return:

[EINVAL] if
    The file_name argument is a null pointer.


>How-To-Repeat:
call realpath(NULL, ...); and it will crash.
>Fix:
Replace the _DIAGASSERT(path != NULL);

with

if (path == NULL) {
    errno = EINVAL;
    return (NULL);
}

in

http://opengrok.netbsd.org/xref/src/lib/libc/gen/getcwd.c lines 77 and 90

P.S. sorry for not providing a real patch.



Home | Main Index | Thread Index | Old Index