summaryrefslogtreecommitdiff
path: root/print-fr.c
Commit message (Collapse)AuthorAgeFilesLines
* Put "}" at beginning of line with "else" to keep a consistent styleFrancois-Xavier Le Bail2023-04-211-2/+1
| | | | [skip ci]
* Frame Relay: make the buffer big enough for the biggest message.Guy Harris2021-05-251-1/+1
|
* Frame Relay: have q922_string() handle errors better.Guy Harris2021-05-251-3/+11
| | | | Have it return a string indicating an error, rather than a null string.
* FR: Fix a typo in a comment.Denis Ovsienko2020-09-081-1/+1
|
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-1/+0
| | | | | | | Remove a number of instances that do not match common patterns and have the only substantial effect on the code flow that a truncated packet triggers "goto trunc" instead of longjmp(). (In a few cases this change can increase the number of fields printed before giving up.)
* Remove many (762) now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-061-1/+0
| | | | | | | | | | | ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }. They are redundant because they are followed by a GET_.*_n(e) call, same n, same e, which do the bounds check. Remove unused 'trunc' labels and most associated codes. Update the outputs of some tests accordingly.
* FR: Update the link-layer dissectors to void functionsFrancois-Xavier Le Bail2020-08-041-20/+18
| | | | | | Moreover: Remove trailing "_if" from the protocol name. Add two comments.
* FR: Remove useless "oui.h" includeFrancois-Xavier Le Bail2020-03-311-1/+0
|
* FRF.16: Add a length check before the bounds checkFrancois-Xavier Le Bail2019-10-281-1/+7
| | | | | | | At the beginning of mfr_print() check the declared length. Updated from e5ae1fd2c5d86277e76ec901ed5f311df731caff in 4.9 branch.
* FRF.16: Add a length checkFrancois-Xavier Le Bail2019-10-191-0/+6
| | | | | | | | | | 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.
* Remove more old-compiler compensation.Guy Harris2019-08-081-1/+1
| | | | | | | | | | | | We require an environment with a C99-compatible snprintf(), so we don't need to work around older implementations. Make the configuration process fail if we don't have snprintf() and vsnprintf(). We require at least VS 2015, so we don't have to check for _MSC_VER >= 1400. Make the build fail if we don't have at least VS 2015. We apparently do, however, have to use __inline, as the VS 2015 documentation doesn't meaning plain old "inline". Update a comment.
* Fix some narrowing warnings on LP64/LLP64 platforms.Guy Harris2019-04-181-2/+2
| | | | | | | | | | | | Add a ND_BYTES_AVAILABLE_AFTER() macro to find the number of bytes available in the captured data, starting at the byte pointed to by the argument. It returns a u_int rather than a ptrdiff_t, so it'll be 32 bits on LP64 and LLP64 platforms as well as on ILP32 platforms. Use that macro. Make size-of-buffer arguments size_t. Cast some size_t and ptrdiff_t values to u_int or int.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-53/+53
| | | | | | | The exceptions are currently: Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer. An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer pointer.
* Add more nd_print_trunc() callsFrancois-Xavier Le Bail2018-05-231-11/+11
| | | | | | | Update the output of some tests accordingly. Moreover: Update a ndo_protocol assignment.
* Remove the safeputchar() functionFrancois-Xavier Le Bail2018-05-021-1/+1
| | | | | | Print the characters filtering out non-printable with fn_print_char(). Update the output of some tests accordingly.
* Remove useless commentsFrancois-Xavier Le Bail2018-03-191-6/+0
|
* Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+5
| | | | | Update this field in printer entry functions. It will be used for some printings.
* Add some const qualifiersFrancois-Xavier Le Bail2018-03-161-1/+1
|
* Add nd_{v}snprintf() routines/wrappers.Guy Harris2018-01-291-1/+1
| | | | | | | | Some versions of the MSVC runtime library have a non-C99-compliant vsnprintf(), which we want to avoid. On Windows, use snprintf() and vsnprintf() for VS 2015 and later, where they both exist in C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're guaranteed to do the null termination that we want).
* Always include <config.h> rather than "config.h".Guy Harris2018-01-211-1/+1
| | | | | | | | This can prevent bizarre failures if, for example, you've done a configuration in the top-level source directory, leaving behind one config.h file, and then do an out-of-tree build in another directory, with different configuration options. This way, we always pick up the same config.h, in the build directory.
* Use quoted include netdissect-stdinc.h instead of angle-bracketed oneFrancois-Xavier Le Bail2018-01-211-1/+1
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-62/+62
|
* FR: Add parentheses when extracting the flagsFrancois-Xavier Le Bail2017-12-231-2/+2
| | | | Should fix Coverity CID 1426919.
* FR: Rework extracting the flagsFrancois-Xavier Le Bail2017-12-171-15/+13
| | | | | Moreover: Rename parse_q922_addr to parse_q922_header
* Fix spacesFrancois-Xavier Le Bail2017-12-171-2/+2
|
* FR: Fix extracting the DE flagFrancois-Xavier Le Bail2017-12-171-1/+1
| | | | Update the output of a test accordingly.
* Use more the ND_TTEST_1() macroFrancois-Xavier Le Bail2017-12-151-6/+6
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-8/+8
| | | | | | Let the compiler do the optimizations (or not) based on build options. Avoid 'value has been optimized out' messages in gdb using '-O0'.
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-3/+3
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Use more the EXTRACT_U_1() macro (52/n)Francois-Xavier Le Bail2017-12-091-2/+2
| | | | Assignment, p[n]
* Use more the EXTRACT_U_1() macro (51/n)Francois-Xavier Le Bail2017-12-091-1/+1
| | | | Moreover: Use more the ND_ISPRINT() macro.
* Use more the EXTRACT_U_1() macro (35/n)Francois-Xavier Le Bail2017-11-301-1/+1
| | | | In some safeputchar() calls, *(p).
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-4/+4
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-51/+51
| | | | | | | | | | | | | | | | Now all the macros have a name meaning a count in bytes. With _S_: signed, _U_: unsigned e.g.: EXTRACT_BE_32BITS -> EXTRACT_BE_U_4 EXTRACT_LE_32BITS -> EXTRACT_LE_U_4 ... EXTRACT_BE_INT32 -> EXTRACT_BE_S_4 and have: EXTRACT_8BITS -> EXTRACT_U_1 EXTRACT_INT8 -> EXTRACT_S_1
* Rename ND_TCHECK_/ND_TTEST_ macrosFrancois-Xavier Le Bail2017-11-221-9/+9
| | | | | | | | Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
* Fix a bound checkFrancois-Xavier Le Bail2017-11-201-1/+1
|
* More EXTRACT_8BITS() changes. Use ND_CHECK_nBITS() more as well.Guy Harris2017-11-191-56/+58
|
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-4/+4
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-12897/ISO CLNS: Use ND_TTEST() for the bounds checks in ↵Guy Harris2017-09-131-1/+1
| | | | | | | | | | | isoclns_print(). This fixes a buffer over-read discovered by Kamil Frankowicz. Don't pass the remaining caplen - that's too hard to get right, and we were getting it wrong in at least one case; just use ND_TTEST(). Add a test using the capture file supplied by the reporter(s).
* Frame Relay: denote a genuine fall through caseDenis Ovsienko2017-07-221-0/+1
| | | | | | | | | | | | | The source code comment explains it should fall through but GCC does not pick it up, that's what the new macro is for. ./print-fr.c: In function ‘mfr_print’: ./print-fr.c:510:20: warning: this statement may fall through [-Wimplicit-fallthrough=] if (ie_len == sizeof(struct timeval)) { ^ ./print-fr.c:521:13: note: here case MFR_CTRL_IE_VENDOR_EXT: ^~~~
* CVE-2017-5482/Q.933: add a missing bounds checkDenis Ovsienko2017-01-181-0/+1
| | | | | | Brian Carpenter had found that regardless of CVE-2016-8575 q933_print() still could overread the buffer trying to parse a short packet. This change fixes the problem.
* pass correct caplen to other functions as wellDenis Ovsienko2017-01-181-3/+3
| | | | | | | | | | In ethertype_print(), isoclns_print() and snap_print() adjust the length arithmetics along the same lines as for ether_print() in the previous commit. Where done, the current pointer is not greater than snapend so that the difference (i.e. caplen) is never negative. This does not fix a reported issue but the problem was very likely to be there.
* CVE-2016-7985,7986/Change the way protocols print link-layer addresses.Guy Harris2017-01-181-1/+2
| | | | | | | | | | | | | | | If a protocol that runs under a link-layer protocol would print the link-layer addresses for the packet as source and destination addresses for the packet, don't have it blithely assume those link-layer addresses are present or are at a particular offset from the beginning of that protocol's data; Ethertypes, for example, are used by a number of protocols, not all of which have Ethernet headers and not all of which have any MAC headers. Instead, pass the printers for those protocols structures with a pointer to the address data and a pointer to a routine that prints the address. Fixes some heap overflows found with American Fuzzy Lop by Hanno Böck.
* Clean up "invalid IE" messages.Guy Harris2016-09-241-2/+2
|
* Fix indentation.Guy Harris2016-09-241-2/+2
|
* Check for invalid IE lengths.Guy Harris2016-09-211-7/+19
| | | | | Also fix a failure to stop printing on error, and rename a routine to reflect that it's used for codesets 0 and 5.
* More cleanups of Q.933 output.Guy Harris2016-09-211-34/+18
|
* Clean up printing of Q.933 packets.Guy Harris2016-09-211-111/+305
| | | | | | | | | | | | | | | | Check the packet length and the snapshot length as we parse the packet. Extract each field as we go. Support arbitrary call reference lengths, 0 to 15 octets. Handle single-octet IEs correctly - don't look for a length. Handle both locking and non-locking shifts correctly. Don't assume that the first octet after the message type is a shift and contains a codeset. We were doing that, meaning that we tended to think codeset 1 was being used (by misparsing an IE with a code of 0x51 as a shift to codeset 1) when it wasn't - codeset 0 was being used; correctly handle codeset 0.
* The name is "FRF.15", so include the "." in the truncation message.Guy Harris2016-09-201-1/+1
|
* Make another never-negative variable an unsigned.Guy Harris2016-09-201-1/+1
| | | | It's assigned a u_int value, and printed with %u, so make it a u_int.