Skip to content

Commit

Permalink
libspdm_rsp_psk_exchange: Fixup PSK Hint Length comparison
Browse files Browse the repository at this point in the history
The maximum length of the PSK hint is referenced by the
LIBSPDM_PSK_MAX_HINT_LENGTH macro (16). We need to ensure that the
length is less then equal to the length of LIBSPDM_PSK_MAX_HINT_LENGTH,
not less then.

This patch ensures that the psk hint is less then or equal to
LIBSPDM_PSK_MAX_HINT_LENGTH which also matches the check when setting
the psk_hint buffer for the local context.

Signed-off-by: Alistair Francis <[email protected]>
  • Loading branch information
alistair23 authored and jyao1 committed Mar 29, 2023
1 parent 7a1aa58 commit 9ad78c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/spdm_responder_lib/libspdm_rsp_psk_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ libspdm_return_t libspdm_get_response_psk_exchange(libspdm_context_t *spdm_conte
if (spdm_request->psk_hint_length == 0) {
psk_hint_size = 0;
psk_hint = NULL;
} else if(spdm_request->psk_hint_length < LIBSPDM_PSK_MAX_HINT_LENGTH ) {
} else if(spdm_request->psk_hint_length <= LIBSPDM_PSK_MAX_HINT_LENGTH ) {
psk_hint_size = spdm_request->psk_hint_length;
psk_hint = (const uint8_t *)request +
sizeof(spdm_psk_exchange_request_t);
Expand Down

0 comments on commit 9ad78c3

Please sign in to comment.