cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 6397cd8abe96c0b915d03ec564e35f0d3fba3714
parent ce7315e485e5677a7c61bb63106b5cd198bbcf4d
Author: Michael Forney <mforney@mforney.org>
Date:   Sat,  6 Apr 2019 13:32:18 -0700

driver: Make sure we have room for the '\0' byte

Diffstat:
Mdriver.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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)