Improve frame encoding error handling, reporting
Changes: * Improve error detection in patty_ax25_frame_encode() * Make patty_ax25_frame_encode() set EOVERFLOW when encoding beyond the caller specified limit * Make patty_ax25_frame_encode_reply_to() set EOVERFLOW when encoding beyond the caller specified limit
This commit is contained in:
parent
30b17d337b
commit
bd1238e0bd
1 changed files with 5 additions and 1 deletions
|
@ -476,7 +476,9 @@ ssize_t patty_ax25_frame_encode(patty_ax25_frame *frame,
|
|||
}
|
||||
|
||||
if (frame->info && frame->infolen) {
|
||||
if (1 + offset + frame->infolen > len) {
|
||||
if (len < 1 + offset + frame->infolen) {
|
||||
errno = EOVERFLOW;
|
||||
|
||||
goto error_toobig;
|
||||
}
|
||||
|
||||
|
@ -623,6 +625,8 @@ ssize_t patty_ax25_frame_encode_reply_to(patty_ax25_frame *frame,
|
|||
|
||||
if (PATTY_AX25_FRAME_CONTROL_I(reply->control) || PATTY_AX25_FRAME_CONTROL_UI(reply->control)) {
|
||||
if (len < 1 + offset + reply->infolen) {
|
||||
errno = EOVERFLOW;
|
||||
|
||||
goto error_toobig;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue