From 6397cd8abe96c0b915d03ec564e35f0d3fba3714 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 6 Apr 2019 13:32:18 -0700 Subject: driver: Make sure we have room for the '\0' byte --- driver.c | 4 ++-- 1 file 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) -- cgit v1.2.3