From 39306151048a614897febc91ef3b42d5caf53cbf Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 10 Jun 2013 23:08:17 +0200 Subject: [PATCH] Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius) --- libi3/get_exe_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libi3/get_exe_path.c b/libi3/get_exe_path.c index 8176aa76..a308e242 100644 --- a/libi3/get_exe_path.c +++ b/libi3/get_exe_path.c @@ -25,7 +25,7 @@ const char *get_exe_path(const char *argv0) { #endif ssize_t linksize; - if ((linksize = readlink(exepath, destpath, sizeof(destpath))) != -1) { + if ((linksize = readlink(exepath, destpath, sizeof(destpath) - 1)) != -1) { /* readlink() does not NULL-terminate strings, so we have to. */ destpath[linksize] = '\0';