Skip to content

Commit

Permalink
nfs: fix integer underflow
Browse files Browse the repository at this point in the history
Fix int underflow that leads to Rust panic in NFS3 readdirplus
parsing.

Reported-by: Sirko Höer -- Code Intelligence for DCSO.
  • Loading branch information
victorjulien committed Apr 30, 2019
1 parent 316a411 commit 63ab296
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rust/src/nfs/nfs3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ impl NFSState {
nfs_status = reply.status;

// cut off final eof field
let d = &reply.data[..reply.data.len()-4 as usize];
let d = if reply.data.len() >= 4 {
&reply.data[..reply.data.len()-4 as usize]
} else {
reply.data
};

// store all handle/filename mappings
match many0_nfs3_response_readdirplus_entries(d) {
Expand Down

0 comments on commit 63ab296

Please sign in to comment.