summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/general.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/general.c b/src/general.c
index bf7afd1..7ec80a8 100644
--- a/src/general.c
+++ b/src/general.c
@@ -19,7 +19,8 @@ bool slurp(const char *filename, char *destination, int size) {
if ((fd = open(filename, O_RDONLY)) == -1)
return false;
- int n = read(fd, destination, size);
+ /* We need one byte for the trailing 0 byte */
+ int n = read(fd, destination, size-1);
if (n != -1)
destination[n] = '\0';
(void)close(fd);