diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-08-03 10:16:20 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-08-03 20:26:34 +0200 |
commit | 09822d484b0f26d197a1ea8fdf81ca6e0d698634 (patch) | |
tree | 7b62e99bafe0bccd6768ccbda5861ff6a8e837ed /print-sflow.c | |
parent | 40f1cf8aa72185cce0994aaaf8b14d524e5a4d8b (diff) | |
download | tcpdump-09822d484b0f26d197a1ea8fdf81ca6e0d698634.tar.gz |
sFlow: Add a length check
Diffstat (limited to 'print-sflow.c')
-rw-r--r-- | print-sflow.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/print-sflow.c b/print-sflow.c index 68bca017..f17f1ce9 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -872,6 +872,13 @@ sflow_print(netdissect_options *ndo, tptr = pptr; tlen = len; sflow_datagram = (const struct sflow_datagram_t *)pptr; + if (len < sizeof(struct sflow_datagram_t)) { + ND_PRINT("sFlowv%u", GET_BE_U_4(sflow_datagram->version)); + ND_PRINT(" [length %u < %" PRIsize "]", + len, sizeof(struct sflow_datagram_t)); + nd_print_invalid(ndo); + return; + } ND_TCHECK_SIZE(sflow_datagram); /* |