summaryrefslogtreecommitdiffstats
path: root/src/manifest_parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/manifest_parser.cc')
-rw-r--r--src/manifest_parser.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc
index f5e7eac..a1bb904 100644
--- a/src/manifest_parser.cc
+++ b/src/manifest_parser.cc
@@ -37,6 +37,14 @@ bool ManifestParser::Load(const string& filename, string* err) {
*err = "loading '" + filename + "': " + read_err;
return false;
}
+
+ // The lexer needs a nul byte at the end of its input, to know when it's done.
+ // It takes a StringPiece, and StringPiece's string constructor uses
+ // string::data(). data()'s return value isn't guaranteed to be
+ // null-terminated (although in practice - libc++, libstdc++, msvc's stl --
+ // it is, and C++11 demands that too), so add an explicit nul byte.
+ contents.resize(contents.size() + 1);
+
return Parse(filename, contents, err);
}