[Tizen] security check : null termination check 17/191617/2
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 17 Oct 2018 01:39:24 +0000 (10:39 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 19 Oct 2018 04:57:52 +0000 (13:57 +0900)
Change-Id: I047b7b4767b9d0c34919c870413a2634c0b4a8de

dali-toolkit/internal/builder/builder-filesystem.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index bbb77d7..d7118dd
@@ -46,7 +46,9 @@ inline std::string ExpandPath(const std::string &name)
 inline std::string ExePath(void)
 {
   char buf[256];
-  readlink("/proc/self/exe", buf, sizeof(buf));
+  ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
+  len = len > 0 ? len : 0;
+  buf[len] = '\0';
   return std::string(buf);
 }