From: Michael Stapelberg Date: Mon, 10 Jun 2013 21:08:17 +0000 (+0200) Subject: Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius) X-Git-Tag: 4.6~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=39306151048a614897febc91ef3b42d5caf53cbf;p=i3%2Fi3 Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius) --- 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';