summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2022-03-10 01:03:05 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-03-10 01:03:05 +0000
commitbb1686a6ac12b14a952e491af01c111fc40a518b (patch)
treef429098fc03c8f056be93463a0004944587da667
parentb56960bc761698b373034cf2922d66c99e71cec5 (diff)
parentedd99c3a7f22e2cb0aab16ec64647a16e9b06359 (diff)
Merge "Correct off-by-one error in SetThreadName"
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 597167026d19..5023927c2560 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -895,7 +895,7 @@ void SetThreadName(const std::string& thread_name) {
// pthread_setname_np fails rather than truncating long strings.
char buf[16]; // MAX_TASK_COMM_LEN=16 is hard-coded into bionic
- strlcpy(buf, name_start_ptr, sizeof(buf) - 1);
+ strlcpy(buf, name_start_ptr, sizeof(buf));
errno = pthread_setname_np(pthread_self(), buf);
if (errno != 0) {
ALOGW("Unable to set the name of current thread to '%s': %s", buf, strerror(errno));