summaryrefslogtreecommitdiff
path: root/Userland/mount.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-11-28 18:10:03 +0330
committerAndreas Kling <kling@serenityos.org>2020-11-29 20:32:10 +0100
commit129a58a2e54a9cb2a4395c76e97c42ee68922bea (patch)
tree5dabae33959d2cb8d51b97a139f91fee575ff923 /Userland/mount.cpp
parentc6ca8534a66018eac9d0b3470f0b0a9691256879 (diff)
downloadserenity-129a58a2e54a9cb2a4395c76e97c42ee68922bea.zip
LibCore: Do not try to null-terminate a ByteBuffer in read_line()
That's just silly :) Also fix that one use of read_line() which assumes it will null-terminated in mount.cpp (this would've blown up if the IODevice was at EOF and had a line with the same size as max_size).
Diffstat (limited to 'Userland/mount.cpp')
-rw-r--r--Userland/mount.cpp2
1 files changed, 1 insertions, 1 deletions
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')