aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-12-03 19:51:22 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-12-03 19:51:22 -0500
commitd279d2d4f6e096eb1a982aeb5f4923eb38a5819a (patch)
treec52953ab318fb89cb0ab872e7a1d314905e657c6
parent354091b80b8fc06f760ad4fd5d2a00c4d82a1831 (diff)
Fixed bug since readlink() does not append '\0'; src/textadept.c
-rw-r--r--src/textadept.c3
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);