Fix readLink(): readlink() doesn't add ending null character.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 10 Oct 2013 12:44:13 +0000 (14:44 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 10 Oct 2013 12:44:13 +0000 (14:44 +0200)
src/VfsNs.cpp

index a6ff7bf..a620b06 100644 (file)
@@ -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;
 }