From e7512ae2d186b292ce08fccdb316ce690fa16ef1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 28 Jan 2020 10:51:48 +0100 Subject: [PATCH] GFileSystemModel: Don't copy the null-terminator after readlink() --- Libraries/LibGUI/GFileSystemModel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } }