]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius)
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 10 Jun 2013 21:08:17 +0000 (23:08 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 10 Jun 2013 21:08:17 +0000 (23:08 +0200)
libi3/get_exe_path.c

index 8176aa76741311a5ae383a022703d5e3a376a040..a308e242c04b7d14ce5acf4447008e5babe26214 100644 (file)
@@ -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';