mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 09:00:35 +00:00
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:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user