hanchenye-llvm-project/lldb/source/Host/macosx
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
..
cfcpp
launcherXPCService Fix accidental over-checking of args in launcherXPCService. 2014-10-16 02:53:57 +00:00
Host.mm Rename the "glob arguments" feature to "shell expand arguments" 2015-02-20 22:20:30 +00:00
HostInfoMacOSX.mm Fix FileSpec::GetPath to return null-terminated strings 2015-02-27 19:43:08 +00:00
HostThreadMacOSX.mm Create a HostThread abstraction. 2014-09-09 20:54:56 +00:00
Makefile
Symbols.cpp Fix a -Wnull-conversion warning. 2015-01-15 17:55:24 +00:00
ThisThread.cpp Create a HostThread abstraction. 2014-09-09 20:54:56 +00:00