]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: null-terminate buffer
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 26 Mar 2010 02:04:54 +0000 (03:04 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 26 Mar 2010 02:04:54 +0000 (03:04 +0100)
src/cfgparse.y

index e2b034126c1ae8902e68cad5a9dca5e4733befef..2774f05ca6be014812ec464cde077c6ee4d4d1d1 100644 (file)
@@ -70,7 +70,7 @@ void parse_file(const char *f) {
         if (fstat(fd, &stbuf) == -1)
                 die("Could not fstat file: %s\n", strerror(errno));
 
-        buf = smalloc(stbuf.st_size * sizeof(char));
+        buf = scalloc((stbuf.st_size + 1) * sizeof(char));
         while (read_bytes < stbuf.st_size) {
                 if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0)
                         die("Could not read(): %s\n", strerror(errno));