Skip to content

Commit 9ab359e

Browse files
committed
CONTRIBUTING: remove redundant information, add additional information. [skip ci]
Remove a paragraph left over from the process of editing. Indicate what the individual ND_TCHECK_*() macros do, and indicate that *n*, in the GET_*_n() macros, is the length of the item to be fetched, in bytes.
1 parent 4c5691c commit 9ab359e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ and ask!
167167
This means that an attempt to fetch packet data based on the expected
168168
format of the packet may run the risk of overrunning the buffer.
169169

170-
This is because the printer may receive incomplete packet in the
171-
buffer, truncated at any random position, for example by capturing
172-
with `-s size` option, so any attempt to fetch packet data based on
173-
the expected format of the packet may run the risk of overrunning the
174-
buffer.
175-
176170
Furthermore, if the packet is complete, but is not correctly formed,
177171
that can also cause a printer to overrun the buffer, as it will be
178172
fetching packet data based on the expected format of the packet.
@@ -192,6 +186,13 @@ and ask!
192186
ND_TCHECK_SIZE(p)
193187
ND_TCHECK_LEN(p, l)
194188
```
189+
190+
where *p* points to the data not being decoded. For `ND_CHECK_n()`,
191+
*n* is the length of the gap, in bytes. For `ND_CHECK_SIZE()`, the
192+
length of the gap, in bytes, is the size of an item of the data type
193+
to which *p* points. For `ND_CHECK_LEN()`, *l* is the length of the
194+
gap, in bytes.
195+
195196
For the `GET_*()` and `ND_TCHECK_*` macros (if not already done):
196197
* Assign: `ndo->ndo_protocol = "protocol";`
197198
* Define: `ND_LONGJMP_FROM_TCHECK` before including `netdissect.h`
@@ -221,7 +222,8 @@ and ask!
221222
`U` indicates that an unsigned value is fetched; `S` indicates that a
222223
signed value is fetched. For multi-byte values, `BE` indicates that
223224
a big-endian value ("network byte order") is fetched, and `LE`
224-
indicates that a little-endian value is fetched.
225+
indicates that a little-endian value is fetched. *n* is the length,
226+
in bytes, of the multi-byte integral value to be fetched.
225227

226228
In addition to the bounds checking the `GET_*()` macros perform,
227229
using those macros has other advantages:

0 commit comments

Comments
 (0)