[haiku-commits] Change in haiku[master]: bin/bfs_tools: Fix array index is out of bounds

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 13 Dec 2020 11:07:21 +0000

From Murai Takashi <tmurai01@xxxxxxxxx>:

Murai Takashi has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3501 ;)


Change subject: bin/bfs_tools: Fix array index is out of bounds
......................................................................

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
---
M src/bin/bfs_tools/lib/dump.cpp
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/01/3501/1

diff --git a/src/bin/bfs_tools/lib/dump.cpp b/src/bin/bfs_tools/lib/dump.cpp
index 523e50c..178e9f4 100644
--- a/src/bin/bfs_tools/lib/dump.cpp
+++ b/src/bin/bfs_tools/lib/dump.cpp
@@ -240,7 +240,7 @@
                        break;
                }

-               char buffer[256];
+               char buffer[BPLUSTREE_MAX_KEY_LENGTH + 1];
                memcpy(buffer, key, length);
                buffer[length] = '\0';


--
To view, visit https://review.haiku-os.org/c/haiku/+/3501
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ib86abeaa72526b327af85ca9a26b050834f5a2c9
Gerrit-Change-Number: 3501
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: bin/bfs_tools: Fix array index is out of bounds - Gerrit