hanchenye-llvm-project/lldb
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
..
cmake Resubmit "[CMake] Change lldbAPI to be a CMake OBJECT library." 2015-02-24 22:17:57 +00:00
docs 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
examples Specify ObjC++ when running heap commands in case we are stopped in a frame with another language. 2015-01-14 21:37:19 +00:00
gtest Fix compilation error and cleanup in ThreadStateCoordinatorTest 2015-02-03 01:51:54 +00:00
include Remove duplicated code for synthetic array members. 2015-02-26 23:55:39 +00:00
lib Fix configure+make build broken by r228943 (part 2) 2015-02-13 12:27:24 +00:00
lldb.xcodeproj Fixed Xcode project after recent changes: 2015-02-24 23:50:21 +00:00
lldb.xcworkspace Fixup gtest layout, add Linux ThreadStateCoordinator.cpp. 2014-09-25 19:25:07 +00:00
resources Bump the verison number in the xcode project files. 2014-08-21 23:27:02 +00:00
scripts [swig] Fix some typos in the build scripts. 2015-02-26 23:53:49 +00:00
source Fix FileSpec::GetPath to return null-terminated strings 2015-02-27 19:43:08 +00:00
test Skip LaunchInTerminalTestCase test on remote systems 2015-02-27 19:14:12 +00:00
tools Fix handling of double quotes (MI) 2015-02-26 18:21:22 +00:00
utils LUI: Fix some issues causing crashes in the source view 2013-10-23 01:18:21 +00:00
www Fix broken link to 'Obtaining Commit Access' 2015-02-18 16:51:30 +00:00
.arcconfig Update .arcconfig to point to reviews.llvm.org 2014-05-20 21:24:59 +00:00
.clang-format Fix .clang-format file to adhere to LLDB 140 column limit. 2014-08-19 17:18:38 +00:00
.gitignore Added remote-build.py and wired it into Xcode for Linux and MacOSX+Linux builds. 2015-02-03 01:50:39 +00:00
CMakeLists.txt [CMake] Clean up lldb-mi CMakeLists.txt. 2015-02-24 23:36:12 +00:00
INSTALL.txt Revert "git-svn test commit" 2014-11-18 22:45:59 +00:00
LICENSE.TXT
Makefile Remove the -Wno-unused-function option. We are clean 2014-09-09 07:49:15 +00:00