Skip to content

Commit

Permalink
fix out-of-bounds issue for certificate response.
Browse files Browse the repository at this point in the history
fix #97

Signed-off-by: Yang, Longlong <longlong.yang@intel.com>
  • Loading branch information
longlongyang authored and jyao1 committed Jun 13, 2024
1 parent 5c89fff commit 59aa578
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spdmlib/src/requester/encap_certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl RequesterContext {
}

let offset = get_certificate.offset;
if offset > my_cert_chain.data_size {
if offset >= my_cert_chain.data_size {
self.encode_encap_error_response(
SpdmErrorCode::SpdmErrorInvalidRequest,
0,
Expand Down
2 changes: 1 addition & 1 deletion spdmlib/src/responder/certificate_rsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl ResponderContext {
}

let offset = get_certificate.offset;
if offset > my_cert_chain.data_size {
if offset >= my_cert_chain.data_size {
self.write_spdm_error(SpdmErrorCode::SpdmErrorInvalidRequest, 0, writer);
return (
Err(SPDM_STATUS_INVALID_MSG_FIELD),
Expand Down

0 comments on commit 59aa578

Please sign in to comment.