Skip to content

Commit

Permalink
Fix warnings reports by MIRAI in src/spdm
Browse files Browse the repository at this point in the history
Fix #28

Signed-off-by: Ceping Sun <[email protected]>
  • Loading branch information
sunceping authored and mxu9 committed Sep 6, 2023
1 parent b4fd18f commit f7a31d9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/spdm/src/vtpm_transport_encap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ impl SpdmTransportEncap for VtpmTransportEncap {
}

let header_size = reader.used();

if header_size > transport_buffer.len() {
return Err(SPDM_STATUS_INVALID_PARAMETER);
}

let payload_size = transport_buffer.len() - header_size;

if spdm_buffer.len() < payload_size {
Expand Down

0 comments on commit f7a31d9

Please sign in to comment.