Skip to content

Commit

Permalink
fix out of range issue found by fuzz.
Browse files Browse the repository at this point in the history
fix #36

Signed-off-by: Yang, Longlong <[email protected]>
  • Loading branch information
longlongyang committed Feb 21, 2024
1 parent b9e6bb9 commit ab2fd03
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spdmlib/src/crypto/x509v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ fn get_key_usage_value(data: &[u8]) -> SpdmResult<(bool, u8)> {
let mut find_key_usage = false;
let len = data.len();
let key_usage_oid_len = OID_KEY_USAGE.len();
if len < 1 {
return Err(SPDM_STATUS_VERIF_FAIL);
}
let (data_length, bytes_consumed) = check_length(&data[1..])?;
if len < 1 + data_length + bytes_consumed {
Err(SPDM_STATUS_VERIF_FAIL)
Expand Down

0 comments on commit ab2fd03

Please sign in to comment.