diff --git a/unit_test/test_spdm_responder/error_test/vendor_response_err.c b/unit_test/test_spdm_responder/error_test/vendor_response_err.c index e1b407e1692..2aa8c065f86 100644 --- a/unit_test/test_spdm_responder/error_test/vendor_response_err.c +++ b/unit_test/test_spdm_responder/error_test/vendor_response_err.c @@ -69,7 +69,7 @@ static void libspdm_test_responder_vendor_cmds_err_case1(void **state) libspdm_return_t status; libspdm_test_context_t *spdm_test_context; libspdm_context_t *spdm_context; - uint8_t request_buffer[255] = {0}; + uint8_t request_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0}; libspdm_vendor_request_test request; libspdm_vendor_response_test response = {0}; response.vendor_id_len = sizeof(response.vendor_id); @@ -93,16 +93,15 @@ static void libspdm_test_responder_vendor_cmds_err_case1(void **state) assert_int_equal(status, LIBSPDM_STATUS_SUCCESS); request.standard_id = 6; - request.vendor_id_len = 2; - request.vendor_id[0] = 0xAA; - request.vendor_id[1] = 0xAA; + request.vendor_id_len = sizeof(request.vendor_id); + libspdm_set_mem(request.vendor_id, sizeof(request.vendor_id), 0xAA); request.data_len = sizeof(request.data); libspdm_set_mem(request.data, sizeof(request.data), 0xAA); response_len = sizeof(response); /* copy header of request structure to buffer */ - libspdm_copy_mem(request_buffer, 255, &request, + libspdm_copy_mem(request_buffer, sizeof(request_buffer), &request, sizeof(request.header) + 3 + request.vendor_id_len); /* copy the request data to the correct offset in the request_buffer */ libspdm_copy_mem(request_buffer + sizeof(request.header) + 3 + request.vendor_id_len, diff --git a/unit_test/test_spdm_responder/vendor_response.c b/unit_test/test_spdm_responder/vendor_response.c index 73219ccae75..4471c4bb90f 100644 --- a/unit_test/test_spdm_responder/vendor_response.c +++ b/unit_test/test_spdm_responder/vendor_response.c @@ -92,8 +92,8 @@ static void libspdm_test_responder_vendor_cmds_case1(void **state) libspdm_return_t status; libspdm_test_context_t *spdm_test_context; libspdm_context_t *spdm_context; - uint8_t request_buffer[255] = {0}; - uint8_t response_buffer[255] = {0}; + uint8_t request_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0}; + uint8_t response_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0}; libspdm_vendor_request_test request = {0}; libspdm_vendor_response_test response = {0}; size_t response_len = 0; @@ -120,16 +120,15 @@ static void libspdm_test_responder_vendor_cmds_case1(void **state) assert_int_equal(status, LIBSPDM_STATUS_SUCCESS); request.standard_id = 6; - request.vendor_id_len = 2; - request.vendor_id[0] = 0xAA; - request.vendor_id[1] = 0xAA; + request.vendor_id_len = sizeof(request.vendor_id); + libspdm_set_mem(request.vendor_id, sizeof(request.vendor_id), 0xAA); request.data_len = sizeof(request.data); libspdm_set_mem(request.data, sizeof(request.data), 0xAA); response_len = sizeof(response); /* copy header of request structure to buffer */ - libspdm_copy_mem(request_buffer, 255, &request, + libspdm_copy_mem(request_buffer, sizeof(request_buffer), &request, sizeof(request.header) + 3 + request.vendor_id_len); /* copy the request data to the correct offset in the request_buffer */ libspdm_copy_mem(request_buffer + sizeof(request.header) + 3 + request.vendor_id_len,