diff options
author | 2012-12-03 19:51:22 -0500 | |
---|---|---|
committer | 2012-12-03 19:51:22 -0500 | |
commit | d279d2d4f6e096eb1a982aeb5f4923eb38a5819a (patch) | |
tree | c52953ab318fb89cb0ab872e7a1d314905e657c6 | |
parent | 354091b80b8fc06f760ad4fd5d2a00c4d82a1831 (diff) |
Fixed bug since readlink() does not append '\0'; src/textadept.c
-rw-r--r-- | src/textadept.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |