summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-01-28 10:51:48 +0100
committerAndreas Kling <kling@serenityos.org>2020-01-28 10:52:10 +0100
commite7512ae2d186b292ce08fccdb316ce690fa16ef1 (patch)
tree34d1900e2c99c3642504ec4c141dcd24f43ece5f /Libraries/LibGUI
parent8131875da69df7b813eb52e18adaebcf695fb1a7 (diff)
downloadserenity-e7512ae2d186b292ce08fccdb316ce690fa16ef1.zip
GFileSystemModel: Don't copy the null-terminator after readlink()
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/GFileSystemModel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GFileSystemModel.cpp b/Libraries/LibGUI/GFileSystemModel.cpp
index 1f1bc35cc4..c0ed10eb8c 100644
--- a/Libraries/LibGUI/GFileSystemModel.cpp
+++ b/Libraries/LibGUI/GFileSystemModel.cpp
@@ -75,7 +75,8 @@ bool GFileSystemModel::Node::fetch_data(const String& full_path, bool is_root)
if (length < 0) {
perror("readlink");
} else {
- symlink_target = String(buffer, length);
+ ASSERT(length > 0);
+ symlink_target = String(buffer, length - 1);
}
}