diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-10-18 18:31:02 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-10-19 15:05:46 +0200 |
commit | ac5baa713cefde60313836eac51900744be55d68 (patch) | |
tree | b42aa39e79e9a45147bce25ac296d164c4f3f309 | |
parent | 8f19f1890c5cb962c1b6953e3deb25f171e9b3a0 (diff) | |
download | tcpdump-ac5baa713cefde60313836eac51900744be55d68.tar.gz |
FRF.16: Add a length check
The specification says in a well-formed Magic Number Information Element
the data is exactly 4 bytes long. This gives a more accurate output.
Update the output of a test accordingly.
Partial update from aa3e54f594385ce7e1e319b0c84999e51192578b
in 4.9 branch.
-rw-r--r-- | print-fr.c | 6 | ||||
-rw-r--r-- | tests/frf16_magic_ie-oobr.out | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -495,6 +495,12 @@ mfr_print(netdissect_options *ndo, switch (ie_type) { case MFR_CTRL_IE_MAGIC_NUM: + /* FRF.16.1 Section 3.4.3 Magic Number Information Element */ + if (ie_len != 4) { + ND_PRINT("[IE data length %d != 4]", ie_len); + nd_print_invalid(ndo); + break; + } ND_PRINT("0x%08x", GET_BE_U_4(tptr)); break; diff --git a/tests/frf16_magic_ie-oobr.out b/tests/frf16_magic_ie-oobr.out index d3bc971c..3bdf2a2f 100644 --- a/tests/frf16_magic_ie-oobr.out +++ b/tests/frf16_magic_ie-oobr.out @@ -1,2 +1,2 @@ 1 [Error converting time] FRF.16 Control, Flags [Begin, End, Control], Unknown Message (0x00), length 262144 - IE Magic Number (3), length 3: [|mfr] + IE Magic Number (3), length 3: [IE data length 1 != 4] (invalid) [|mfr] |