diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-11-28 18:10:03 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-29 20:32:10 +0100 |
commit | 129a58a2e54a9cb2a4395c76e97c42ee68922bea (patch) | |
tree | 5dabae33959d2cb8d51b97a139f91fee575ff923 /Libraries/LibCore | |
parent | c6ca8534a66018eac9d0b3470f0b0a9691256879 (diff) | |
download | serenity-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 'Libraries/LibCore')
-rw-r--r-- | Libraries/LibCore/IODevice.cpp | 3 |
1 files changed, 1 insertions, 2 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; } } |