[Bug 239142] pthread_set_name_np no longer allows NULL to clear the thread name
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Jul 11 12:08:11 UTC 2019
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: threads at FreeBSD.org
Reporter: lew at perftech.com
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.
More information about the freebsd-threads
mailing list