From 2288801e71a3754ab3e61998fd6383305f8d795a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Thu, 10 Oct 2013 14:44:13 +0200 Subject: [PATCH] Fix readLink(): readlink() doesn't add ending null character. --- src/VfsNs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VfsNs.cpp b/src/VfsNs.cpp index a6ff7bf..a620b06 100644 --- a/src/VfsNs.cpp +++ b/src/VfsNs.cpp @@ -192,7 +192,9 @@ void VfsCatalog::symlink(const std::string& oldpath, const std::string& newpath) std::string VfsCatalog::readLink(const std::string& path) throw (DmException) { char buf[PATH_MAX]; - wrapCall(readlink(path.c_str(), buf, sizeof(buf))); + + memset(buf, 0, sizeof(buf)); + wrapCall(readlink(path.c_str(), buf, sizeof(buf) - 1)); return buf; } -- 1.8.2.3