[Lldb-commits] [lldb] r362192 - Fix off-by-one error.

Richard Trieu via lldb-commits lldb-commits at lists.llvm.org
Thu May 30 22:06:54 PDT 2019


Author: rtrieu
Date: Thu May 30 22:06:54 2019
New Revision: 362192

URL: http://llvm.org/viewvc/llvm-project?rev=362192&view=rev
Log:
Fix off-by-one error.

The created string is one char too large, so it pulls the terminating NULL as
the last character of the string.  This later causes SocketTest.cpp to fail.

Modified:
    lldb/trunk/source/Host/posix/DomainSocket.cpp

Modified: lldb/trunk/source/Host/posix/DomainSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/DomainSocket.cpp?rev=362192&r1=362191&r2=362192&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/DomainSocket.cpp (original)
+++ lldb/trunk/source/Host/posix/DomainSocket.cpp Thu May 30 22:06:54 2019
@@ -136,7 +136,7 @@ std::string DomainSocket::GetSocketName(
       return std::string(saddr_un.sun_path + GetNameOffset(),
                          sock_addr_len -
                              offsetof(struct sockaddr_un, sun_path) -
-                             GetNameOffset());
+                             GetNameOffset() - 1);
   }
   return "";
 }




More information about the lldb-commits mailing list