Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions C/yahdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ int yahdlc_get_data_with_state(yahdlc_state_t *state, yahdlc_control_t *control,
}

state->end_index = state->src_index;

// If we have a frame with a size that equals the src_len (source buffer size),
// then 'i' ends up being one less than the frame size,
// and we therefore report a wrong frame size in the return value.
// Therefore, add 1 to return the correct frame size.
if (state->end_index + 1 == src_len)
{
i++;
}
break;
} else if (src[i] == YAHDLC_CONTROL_ESCAPE) {
state->control_escape = 1;
Expand Down