sstable: fix buffer overflow in TOC

boost::split() expects either a NUL terminated string or a proper container.
We give it neither.

Fix by wrapping the buffer in a string_view, which tells split() what size
the string is.
This commit is contained in:
Avi Kivity
2015-02-28 23:49:07 +02:00
parent 0b29e4bdaa
commit 7441ce5b51

View File

@@ -329,7 +329,7 @@ future<> sstable::read_toc() {
throw malformed_sstable_exception("SSTable too big: " + to_sstring(size) + " bytes.");
}
auto buf = bufptr.get();
std::experimental::string_view buf(bufptr.get(), size);
std::vector<sstring> comps;
boost::split(comps , buf, boost::is_any_of("\n"));