hanchenye-llvm-project/lldb/source/Host/common
Ilia K 686b1fe65a Fix FileSpec::GetPath to return null-terminated strings
Summary:
Before this fix the FileSpec::GetPath() returned string which might be without '\0' at the end.
It could have happened if the size of buffer for path was less than actual path.

Test case:
```
FileSpec test("/path/to/file", false);
char buf[]="!!!!!!";
test.GetPath(buf, 3);
```

Before fix:
```
   233          FileSpec test("/path/to/file", false);
   234          char buf[]="!!!!!!";
   235          test.GetPath(buf, 3);
   236
-> 237          if (core_file)
   238          {
   239              if (!core_file.Exists())
   240              {
(lldb) print buf
(char [7]) $0 = "/pa!!!"
```

After fix:
```
   233          FileSpec test("/path/to/file", false);
   234          char buf[]="!!!!!!";
   235          test.GetPath(buf, 3);
   236
-> 237          if (core_file)
   238          {
   239              if (!core_file.Exists())
   240              {
(lldb) print buf
(char [7]) $0 = "/p"
```

Reviewers: zturner, abidh, clayborg

Reviewed By: abidh, clayborg

Subscribers: tberghammer, vharron, lldb-commits, clayborg, zturner, abidh

Differential Revision: http://reviews.llvm.org/D7553

llvm-svn: 230787
2015-02-27 19:43:08 +00:00
..
Condition.cpp
Editline.cpp Cast EOF to get a proper comparison. 2015-02-12 05:31:46 +00:00
File.cpp Avoid leaking log file descriptors into the inferior process. 2015-02-05 16:44:42 +00:00
FileCache.cpp Move FileSystem functions out of Host and into their own classes. 2014-08-15 22:04:21 +00:00
FileSpec.cpp Fix FileSpec::GetPath to return null-terminated strings 2015-02-27 19:43:08 +00:00
FileSystem.cpp Add qModuleInfo request in order to get module information (uuid, triple,..) by module path from remote platform. 2015-02-25 22:15:44 +00:00
Host.cpp Create new platform: remote-android 2015-02-12 18:13:44 +00:00
HostInfoBase.cpp Use getProcessTriple inside HostInfoBase::ComputeHostArchitectureSupport instead of getDefaultTargetTriple. 2015-02-26 20:02:13 +00:00
HostNativeThreadBase.cpp Fix up the HostThread interface, making the interface simpler. 2014-09-23 18:32:09 +00:00
HostProcess.cpp Create a process launcher abstraction. 2014-10-14 21:55:08 +00:00
HostThread.cpp Change HostThread::GetNativeThread() to return a derived reference. 2014-11-17 22:42:57 +00:00
IOObject.cpp
Makefile
MonitoringProcessLauncher.cpp Fix broken build after signature change of ResolveExecutable. 2014-11-17 21:30:58 +00:00
Mutex.cpp
NativeBreakpoint.cpp Moving header files from source/Host/common to proper location. 2015-02-03 01:51:38 +00:00
NativeBreakpointList.cpp Moving header files from source/Host/common to proper location. 2015-02-03 01:51:38 +00:00
NativeProcessProtocol.cpp Prevent LLGS from crashing when exiting - make NativeProcessLinux to wait until ThreadStateCoordinator is fully stopped before entering ~NativeProcessLinux. 2015-02-19 17:58:04 +00:00
NativeRegisterContext.cpp Implement setting and clearing watchpoints. 2015-02-03 01:51:47 +00:00
NativeRegisterContextRegisterInfo.cpp Moving header files from source/Host/common to proper location. 2015-02-03 01:51:38 +00:00
NativeThreadProtocol.cpp Moving header files from source/Host/common to proper location. 2015-02-03 01:51:38 +00:00
NativeWatchpointList.cpp Implement setting and clearing watchpoints. 2015-02-03 01:51:47 +00:00
OptionParser.cpp Revert "Fix warnings found with clang-cl." 2015-02-25 19:52:41 +00:00
PipeBase.cpp Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver - include reviews fixes. 2015-01-14 01:31:27 +00:00
ProcessRunLock.cpp
Socket.cpp Revert "Fix warnings found with clang-cl." 2015-02-25 19:52:41 +00:00
SocketAddress.cpp Fix FileSpec::GetPath to return null-terminated strings 2015-02-27 19:43:08 +00:00
SoftwareBreakpoint.cpp Moving header files from source/Host/common to proper location. 2015-02-03 01:51:38 +00:00
StringConvert.cpp Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ 2015-01-15 20:08:35 +00:00
Symbols.cpp Skip symlinks to the original file when searching for debug info 2015-02-25 10:44:35 +00:00
Terminal.cpp Revert "Fix warnings found with clang-cl." 2015-02-25 19:52:41 +00:00
ThisThread.cpp Clean-up warnings on Linux/GCC 2014-09-16 06:34:29 +00:00
ThreadLauncher.cpp If lldb is being built with ASAN instrumentation, have lldb 2015-01-29 06:28:36 +00:00
TimeValue.cpp