NetBSD-Bugs archive

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

bin/47757: mktemp(3) mangles the pathname if not given an absolute path



>Number:         47757
>Category:       bin
>Synopsis:       mktemp(3) mangles the pathname if not given an absolute path
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 21 19:30:00 +0000 2013
>Originator:     Eric Radman
>Release:        5.1
>Organization:
eradman.com
>Environment:
it's i386, GENERIC kernel. Don't have access to my test box right now
>Description:
In my tests, mktemp(3) only seems to return the first portion of the path if a 
relative pathname is given
>How-To-Repeat:
#include <stdio.h>
#include <sys/syslimits.h>

int main() {
        char fn[PATH_MAX];

        strlcpy(fn, "tmp/test.XXXXXX", PATH_MAX);
        mktemp(fn);
        printf("'%s'\n", fn);

        return 0;
}

This prints 'tmp' instead of 'tmp/test.XXXXXX'.

>Fix:



Home | Main Index | Thread Index | Old Index