diff options
author | Michael Forney <mforney@mforney.org> | 2019-04-06 13:32:18 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-04-07 00:22:46 -0700 |
commit | 6397cd8abe96c0b915d03ec564e35f0d3fba3714 (patch) | |
tree | 47c9ae2df85fd8033dea90429de8701116357efb | |
parent | ce7315e485e5677a7c61bb63106b5cd198bbcf4d (diff) |
driver: Make sure we have room for the '\0' byte
-rw-r--r-- | driver.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |