Null terminate path returned by readlink().



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123307 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 8d82097..f7a1a24 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -620,9 +620,11 @@
         }
 #elif defined (__linux__)
         char exe_path[PATH_MAX];
-        ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path));
-        if (len >= 0)
+        ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
+        if (len > 0) {
+            exe_path[len] = 0;
             g_program_filespec = FileSpec(exe_path, true);
+        }
 #elif defined (__FreeBSD__)
         int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };
         size_t exe_path_size;