#include <stdlib.h>
#include <unistd.h>
#include <sys/fcntl.h>
+#include <sys/stat.h>
#include "i3status.h"
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);