[libc] Add null-terminator to the thread name obtained from the syscall.
authorSiva Chandra Reddy <sivachandra@google.com>
Thu, 20 Apr 2023 21:30:36 +0000 (21:30 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Thu, 20 Apr 2023 21:35:05 +0000 (21:35 +0000)
This bug was caught by the aarch64 full build builder.

Differential Revision: https://reviews.llvm.org/D148844

libc/src/__support/threads/linux/thread.cpp

index aba8cf0..bc8e16e 100644 (file)
@@ -385,7 +385,7 @@ int Thread::get_name(cpp::StringStream &name) const {
     name_buffer[retval - 1] = '\0';
   else
     name_buffer[retval] = '\0';
-  name << name_buffer;
+  name << name_buffer << cpp::StringStream::ENDS;
   return 0;
 }