summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-11-10 14:25:31 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-11-16 13:43:26 +1000
commitdc1edd140f10b459626d903382df28c74672739b (patch)
treee905ea968fd91a1e166b93018326343c7ff2073b
parent66b2d85a5e5b7b80a85399f54e693afe97a93f2f (diff)
downloadlibinput-dc1edd140f10b459626d903382df28c74672739b.tar.gz
Fix the termination of the readlink result
nread is the number of bytes put into the buffer, let's terminate it there instead of one byte over. This only worked because execdir was initialized to zero. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 34fe17f72353b5fe65724390e4ec384ec848499a)
-rw-r--r--src/builddir.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/builddir.h b/src/builddir.h
index bc0c9e54..19825759 100644
--- a/src/builddir.h
+++ b/src/builddir.h
@@ -50,7 +50,7 @@ builddir_lookup(void)
/* readlink doesn't terminate the string and readlink says
anything past sz is undefined */
- execdir[++nread] = '\0';
+ execdir[nread] = '\0';
pathsep = strrchr(execdir, '/');
if (!pathsep)