From d279d2d4f6e096eb1a982aeb5f4923eb38a5819a Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 3 Dec 2012 19:51:22 -0500 Subject: Fixed bug since readlink() does not append '\0'; src/textadept.c --- src/textadept.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textadept.c b/src/textadept.c index 72e8af67..52b25974 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -2238,7 +2238,8 @@ int main(int argc, char **argv) { char *last_slash = NULL; #if __linux__ textadept_home = malloc(FILENAME_MAX); - int _ = readlink("/proc/self/exe", textadept_home, FILENAME_MAX); + int len = readlink("/proc/self/exe", textadept_home, FILENAME_MAX); + textadept_home[len] = '\0'; if ((last_slash = strrchr(textadept_home, '/'))) *last_slash = '\0'; #elif _WIN32 textadept_home = malloc(FILENAME_MAX); -- cgit v1.2.3