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_schema.c b/src/tree_schema.c
index 6a664fc..41b367e 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1170,7 +1170,7 @@
}
fstat(fd, &sb);
- addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ addr = mmap(NULL, sb.st_size + 1, PROT_READ, MAP_PRIVATE, fd, 0);
if (addr == MAP_FAILED) {
LOGERR(LY_EMEM, "Map file into memory failed (%s()).",__func__);
return NULL;