BUGFIX mmapping regular files
Add one more byte to an mmapped file size to make sure that the last
byte is terminating NULL byte (since mmap() zeroes anything after
the file size).
diff --git a/src/tree_data.c b/src/tree_data.c
index 1047fdc..ef1a39f 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -100,7 +100,7 @@
return NULL;
}
- data = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ data = mmap(NULL, sb.st_size + 1, PROT_READ, MAP_PRIVATE, fd, 0);
if (data == MAP_FAILED) {
LOGERR(LY_ESYS, "Mapping file descriptor into memory failed.");
return NULL;