bin/bfs_tools: Fix array index is out of bounds

If length == BPLUSTREE_MAX_KEY_LENGTH at line 237,
buffer[] index may be out of bounds at line 245.
Pointed out by cppcheck.

Change-Id: Ib86abeaa72526b327af85ca9a26b050834f5a2c9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3501
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Murai Takashi 2020-12-13 19:46:00 +09:00 committed by Jérôme Duval
parent 5b1ae51c6b
commit b66b01c283

View File

@ -240,7 +240,7 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header,
break;
}
char buffer[256];
char buffer[BPLUSTREE_MAX_KEY_LENGTH + 1];
memcpy(buffer, key, length);
buffer[length] = '\0';