@@ -167,12 +167,6 @@ and ask!
167
167
This means that an attempt to fetch packet data based on the expected
168
168
format of the packet may run the risk of overrunning the buffer.
169
169
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
-
176
170
Furthermore, if the packet is complete, but is not correctly formed,
177
171
that can also cause a printer to overrun the buffer, as it will be
178
172
fetching packet data based on the expected format of the packet.
@@ -192,6 +186,13 @@ and ask!
192
186
ND_TCHECK_SIZE(p)
193
187
ND_TCHECK_LEN(p, l)
194
188
```
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
+
195
196
For the ` GET_*() ` and ` ND_TCHECK_* ` macros (if not already done):
196
197
* Assign: ` ndo->ndo_protocol = "protocol"; `
197
198
* Define: ` ND_LONGJMP_FROM_TCHECK ` before including ` netdissect.h `
@@ -221,7 +222,8 @@ and ask!
221
222
` U ` indicates that an unsigned value is fetched; ` S ` indicates that a
222
223
signed value is fetched. For multi-byte values, ` BE ` indicates that
223
224
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.
225
227
226
228
In addition to the bounds checking the ` GET_*() ` macros perform,
227
229
using those macros has other advantages:
0 commit comments