Merge pull request #49078 from ClickHouse/fix-false-report

Prevent false positive report by static analyzer
This commit is contained in:
alesapin 2023-04-24 13:08:37 +02:00 committed by GitHub
commit d28b71e69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ void setThreadName(const char * name)
#endif
DB::throwFromErrno("Cannot set thread name with prctl(PR_SET_NAME, ...)", DB::ErrorCodes::PTHREAD_ERROR);
memcpy(thread_name, name, 1 + strlen(name));
memcpy(thread_name, name, std::min<size_t>(1 + strlen(name), THREAD_NAME_SIZE - 1));
}
const char * getThreadName()