[Bug 239142] pthread_set_name_np no longer allows NULL to clear the thread name

[email protected]
Newsgroups gmane.os.freebsd.devel.threading
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239142

            Bug ID: 239142
           Summary: pthread_set_name_np no longer allows NULL to clear the
                    thread name
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: threads
          Assignee: [email protected]
          Reporter: [email protected]

pthread_set_name_np() previously allowed a NULL pointer to clear the thread
name.

In FreeBSD 12.0, the library will dereference the null pointer, leading to a
segment violation.

In /usr/src/lib/libthr/thread/thr_info.c, we have:

static void
thr_set_name_np(struct pthread *thread, const char *name)
{

        free(thread->name);
        thread->name = strdup(name);
}

The last line of the function should more correctly be:

        thread->name = name ? strdup(name) : NULL;

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.