Skip to content
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 fragment capacity overflow #296

Merged
merged 1 commit into from
Dec 1, 2021
Merged

Conversation

Acuadros95
Copy link
Contributor

@Acuadros95 Acuadros95 commented Dec 1, 2021

Last fragment contains local_args->data_size + SUBHEADER_SIZE + WRITE_DATA_PAYLOAD_SIZE data, and previous if condition only checks for local_args->data_size <= buffer_capacity:

if (local_args->data_size <= buffer_capacity)
{
uxr_buffer_submessage_header(&temp_ub, SUBMESSAGE_ID_FRAGMENT, (uint16_t) local_args->data_size,
FLAG_LAST_FRAGMENT);
uxr_set_reliable_buffer_size(&stream->base, stream->last_written,
local_args->data_size + SUBHEADER_SIZE + WRITE_DATA_PAYLOAD_SIZE);
}

@Acuadros95 Acuadros95 requested a review from pablogs9 December 1, 2021 10:49
@pablogs9
Copy link
Member

pablogs9 commented Dec 1, 2021

Good catch

@Acuadros95 Acuadros95 merged commit abac482 into develop Dec 1, 2021
@pablogs9 pablogs9 deleted the fix/fragment_overflow branch December 1, 2021 10:54
roncapat pushed a commit to roncapat/Micro-XRCE-DDS-Client that referenced this pull request Dec 3, 2021
Signed-off-by: Patrick Roncagliolo <ronca.pat@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants