diff options
author | Philip Paeps <philip@FreeBSD.org> | 2019-10-06 04:36:53 +0000 |
---|---|---|
committer | Philip Paeps <philip@FreeBSD.org> | 2019-10-06 04:36:53 +0000 |
commit | f91036a44a189fa5d0b5f1c6dea0a396a0f928c0 (patch) | |
tree | 2cd0554d9f0826a4e0bc63c5e4ca83ece65bee24 /util-print.c | |
parent | 810711ec13a9424633df50e0a1af057a68e2ed45 (diff) |
Notes
Diffstat (limited to 'util-print.c')
-rw-r--r-- | util-print.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/util-print.c b/util-print.c index 90e11b9f3b80..0e30d7900d41 100644 --- a/util-print.c +++ b/util-print.c @@ -120,10 +120,21 @@ fn_print(netdissect_options *ndo, /* * Print out a null-terminated filename (or other ascii string) from - * a fixed-length buffer. - * If ep is NULL, assume no truncation check is needed. + * a fixed-length field in the packet buffer, or from what remains of + * the packet. + * + * n is the length of the fixed-length field, or the number of bytes + * remaining in the packet based on its on-the-network length. + * + * If ep is non-null, it should point just past the last captured byte + * of the packet, e.g. ndo->ndo_snapend. If ep is NULL, we assume no + * truncation check, other than the checks of the field length/remaining + * packet data length, is needed. + * * Return the number of bytes of string processed, including the - * terminating null, if not truncated. Return 0 if truncated. + * terminating null, if not truncated; as the terminating null is + * included in the count, and as there must be a terminating null, + * this will always be non-zero. Return 0 if truncated. */ u_int fn_printztn(netdissect_options *ndo, @@ -137,7 +148,8 @@ fn_printztn(netdissect_options *ndo, if (n == 0 || (ep != NULL && s >= ep)) { /* * Truncated. This includes "no null before we - * got to the end of the fixed-length buffer". + * got to the end of the fixed-length buffer or + * the end of the packet". * * XXX - BOOTP says "null-terminated", which * means the maximum length of the string, in |