mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-07 18:15:22 -05:00
lib: add bounds to prevent out of bounds read panic
This commit is contained in:
@@ -73,7 +73,8 @@ impl KbinXml {
|
||||
|
||||
// Remove trailing null bytes
|
||||
let mut index = data.len() - 1;
|
||||
while index > 0 && data[index] == 0x00 {
|
||||
let len = data.len();
|
||||
while index < len && data[index] == 0x00 {
|
||||
index -= 1;
|
||||
}
|
||||
data.truncate(index + 1);
|
||||
|
||||
Reference in New Issue
Block a user