Skip to content

Commit

Permalink
Merge pull request #4 from a2x/main
Browse files Browse the repository at this point in the history
Prevent potential integer overflow exception
  • Loading branch information
ko1N authored Mar 30, 2024
2 parents 5b86dbc + e1a3364 commit 7fa06a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/linux/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ impl ProcessVirtualMemory {
match vm_err {
Some(err) => return Err(Error(ErrorOrigin::OsLayer, err)),
_ => {
let mut remaining_written = libcret as usize + 1;
let mut remaining_written = if libcret == -1 {
0
} else {
libcret as usize + 1
};

for (liof, (_, meta)) in iov_local
.iter()
Expand Down

0 comments on commit 7fa06a0

Please sign in to comment.