diff --git a/src/common/thread.cpp b/src/common/thread.cpp index ca0a04c2dd..516a5893ec 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -109,7 +109,7 @@ void SetCurrentThreadName(const char* name) { // attempt to set a longer name with ERANGE. char buf[16]; size_t const len = std::min(std::strlen(name), sizeof(buf) - 1); - std::memcpy(truncated, name, len); + std::memcpy(buf, name, len); buf[len] = '\0'; pthread_setname_np(pthread_self(), buf); }