mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-09 02:55:30 -05:00
lib: ensure index does not go below zero
This commit is contained in:
@@ -111,7 +111,7 @@ impl KbinXml {
|
||||
// Remove trailing null bytes
|
||||
let mut index = data.len() - 1;
|
||||
let len = data.len();
|
||||
while index < len && data[index] == 0x00 {
|
||||
while index > 0 && index < len && data[index] == 0x00 {
|
||||
index -= 1;
|
||||
}
|
||||
data.truncate(index + 1);
|
||||
|
||||
Reference in New Issue
Block a user