[Lldb-commits] [lldb] a53978c - [lldb] Remove a trailing \0 from the result of HostInfoMacOSX::GetOSBuildString

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 25 08:34:26 PDT 2021


Author: Pavel Labath
Date: 2021-10-25T17:33:06+02:00
New Revision: a53978c95c46a8bef563058fa35a688f8cbaaf88

URL: https://github.com/llvm/llvm-project/commit/a53978c95c46a8bef563058fa35a688f8cbaaf88
DIFF: https://github.com/llvm/llvm-project/commit/a53978c95c46a8bef563058fa35a688f8cbaaf88.diff

LOG: [lldb] Remove a trailing \0 from the result of HostInfoMacOSX::GetOSBuildString

This has been in there since forever, but only started to matter once
40e4ac3e changed how we print the string.

Added: 
    

Modified: 
    lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index e32cfb0aade0..5f141b08e866 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -60,7 +60,7 @@
   char cstr[PATH_MAX];
   size_t cstr_len = sizeof(cstr);
   if (::sysctl(mib, 2, cstr, &cstr_len, NULL, 0) == 0)
-    return std::string(cstr, cstr_len);
+    return std::string(cstr, cstr_len - 1);
 
   return llvm::None;
 }


        


More information about the lldb-commits mailing list