aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-06 13:32:18 -0700
committerMichael Forney <mforney@mforney.org>2019-04-07 00:22:46 -0700
commit6397cd8abe96c0b915d03ec564e35f0d3fba3714 (patch)
tree47c9ae2df85fd8033dea90429de8701116357efb
parentce7315e485e5677a7c61bb63106b5cd198bbcf4d (diff)
driver: Make sure we have room for the '\0' byte
-rw-r--r--driver.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/driver.c b/driver.c
index 7bb2be2..5c8b4be 100644
--- a/driver.c
+++ b/driver.c
@@ -310,10 +310,10 @@ compilecommand(void)
char self[PATH_MAX], *cmd;
ssize_t n;
- n = readlink("/proc/self/exe", self, sizeof(self) - 4);
+ n = readlink("/proc/self/exe", self, sizeof(self) - 5);
if (n < 0)
fatal("readlink /proc/self/exe:");
- if (n == sizeof(self) - 4)
+ if (n == sizeof(self) - 5)
fatal("target of /proc/self/exe is too large");
strcpy(self + n, "-qbe");
if (access(self, X_OK) < 0)