OptionValueFileSpec had an accessor to read the contents of the file and return the data. This can end up being used to get the string contents of a text file and could end up not being NULL terminated. I added accessors to get the file contents raw, or with a null terminator. Added the needed calls to make this happen in the FileSpec and File classes.
llvm-svn: 162921
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 2298a1f..23c8678 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2474,7 +2474,8 @@
OptionValueFileSpec *file = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec (NULL, false, idx);
if (file)
{
- DataBufferSP data_sp(file->GetFileContents());
+ const bool null_terminate = true;
+ DataBufferSP data_sp(file->GetFileContents(null_terminate));
if (data_sp)
return (const char *) data_sp->GetBytes();
}