Skip to content

Commit

Permalink
FRF.16: Add a length check before the bounds check
Browse files Browse the repository at this point in the history
At the beginning of mfr_print() check the declared length.

Updated from e5ae1fd
in 4.9 branch.
  • Loading branch information
fxlb committed Oct 28, 2019
1 parent 7ade781 commit 4900c02
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion print-fr.c
Expand Up @@ -458,7 +458,13 @@ mfr_print(netdissect_options *ndo,
*/

ndo->ndo_protocol = "mfr";
ND_TCHECK_4(p); /* minimum frame header length */

if (length < 4) { /* minimum frame header length */
ND_PRINT("[length %u < 4]", length);
nd_print_invalid(ndo);
return length;
}
ND_TCHECK_4(p);

if ((GET_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && GET_U_1(p + 1) == 0) {
ND_PRINT("FRF.16 Control, Flags [%s], %s, length %u",
Expand Down

0 comments on commit 4900c02

Please sign in to comment.