-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix vendor defined request size #2666
Conversation
@m-milinkovic you'll need to replace the whole copyright header with
For some reason this file doesn't have the |
8e67dbe
to
409517d
Compare
@uvinrg, could you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-milinkovic, I think below calculation is risky, since it includes the transport padding.
req_size = (uint16_t)request_size -
sizeof(spdm_vendor_defined_request_msg_t) -
((const spdm_vendor_defined_request_msg_t*)request)->len -
sizeof(uint16_t);
The req_size
should be got from 2 bytes field ReqLength
in spdm_request
, which is precise size. See below:
req_vendor_id = ((const uint8_t *)request) +
sizeof(spdm_vendor_defined_request_msg_t);
req_size = *(const uint16_t *)(req_vendor_id + spdm_request->len);
The pointer of Vendor Defined Request is moved, then the request size should be adjusted accordingly. Signed-off-by: Milan Milinkovic <[email protected]>
409517d
to
162cf02
Compare
Done. Please note that req_data could be obtained in a similar manner (via req_vendor_id), but I already made this commit a bit dirty by renaming spdm_vendor_defined_response_msg_t to spdm_vendor_defined_request_msg_t. I prefer not to go beyond that trivial change. |
Also, please note that, if you decide to merge this commit, I'll check other affected repos (e.g., SPDM-Responder-Validator) and propose a solution as well. |
Hi guys, sorry for the late response. Thank you for the fix, looks good. |
The pointer of Vendor Defined Request is moved, then the request size should be adjusted accordingly.