summaryrefslogtreecommitdiff
path: root/CONTRIBUTING
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-08-23 15:49:51 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-08-23 15:49:51 +0200
commit7f1d17296825058a90188c660c83809d53a66a59 (patch)
treee27f055eed87bd91b6eeb4cece556a9b439ab2ff /CONTRIBUTING
parent180fae3dc2cd43daf047897ac3fb570fe2e4c90a (diff)
downloadtcpdump-7f1d17296825058a90188c660c83809d53a66a59.tar.gz
CONTRIBUTING: Update about bounds checking
Diffstat (limited to 'CONTRIBUTING')
-rw-r--r--CONTRIBUTING15
1 files changed, 12 insertions, 3 deletions
diff --git a/CONTRIBUTING b/CONTRIBUTING
index a5875d96..fae4c739 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -126,9 +126,18 @@ c) Put the format of packets/headers/options as comments if there is no
d) The printer may receive incomplete packet in the buffer, truncated at any
random position, for example by capturing with '-s size' option.
- Thus use ND_TTEST, ND_TTEST_LEN, ND_TCHECK or ND_TCHECK_LEN for bound checking.
- For ND_TCHECK_LEN:
- Define : static const char tstr[] = " [|protocol]";
+ Thus use, for bounds checking, one of the following macros (defined in
+ netdissect.h or extract.h):
+ ND_TCHECK_n(p), n in { 1, 2, 3, 4, 5, 6, 7, 8, 16 }
+ ND_TCHECK_SIZE(p)
+ ND_TCHECK_LEN(p, l)
+
+ ND_TTEST_n(p), n in { 1, 2, 3, 4, 5, 6, 7, 8, 16 }
+ ND_TTEST_SIZE(p)
+ ND_TTEST_LEN(p, l)
+
+ For the ND_TCHECK_* macros (if not already done):
+ Assign: ndo->ndo_protocol = "protocol";
Define a label: trunc
Print with: nd_print_trunc(ndo);
You can test the code via: