summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibCore/IODevice.cpp3
-rw-r--r--Userland/mount.cpp2
2 files changed, 2 insertions, 3 deletions
diff --git a/Libraries/LibCore/IODevice.cpp b/Libraries/LibCore/IODevice.cpp
index 63079c5721..81d759afd0 100644
--- a/Libraries/LibCore/IODevice.cpp
+++ b/Libraries/LibCore/IODevice.cpp
@@ -200,8 +200,7 @@ ByteBuffer IODevice::read_line(size_t max_size)
Vector<u8> new_buffered_data;
new_buffered_data.append(m_buffered_data.data() + line_index, m_buffered_data.size() - line_index);
m_buffered_data = move(new_buffered_data);
- line[line_index] = '\0';
- line.trim(line_index + 1);
+ line.trim(line_index);
return line;
}
}
diff --git a/Userland/mount.cpp b/Userland/mount.cpp
index c01ccc0ec6..6a077c5d43 100644
--- a/Userland/mount.cpp
+++ b/Userland/mount.cpp
@@ -96,7 +96,7 @@ static bool mount_all()
bool all_ok = true;
while (fstab->can_read_line()) {
ByteBuffer buffer = fstab->read_line(1024);
- StringView line_view = (const char*)buffer.data();
+ StringView line_view { buffer.data(), buffer.size() };
// Trim the trailing newline, if any.
if (line_view.length() > 0 && line_view[line_view.length() - 1] == '\n')