diff options
Diffstat (limited to 'print-sflow.c')
-rw-r--r-- | print-sflow.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/print-sflow.c b/print-sflow.c index 37a41b529cd3..dcaf28e8648c 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -881,6 +881,14 @@ 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_TCHECK(sflow_datagram->version); + ND_PRINT((ndo, "sFlowv%u", EXTRACT_32BITS(sflow_datagram->version))); + ND_PRINT((ndo, " [length %u < %zu]", + len, sizeof(struct sflow_datagram_t))); + ND_PRINT((ndo, " (invalid)")); + return; + } ND_TCHECK(*sflow_datagram); /* @@ -916,6 +924,8 @@ sflow_print(netdissect_options *ndo, /* skip Common header */ tptr += sizeof(const struct sflow_datagram_t); + + if(tlen <= sizeof(const struct sflow_datagram_t)) goto trunc; tlen -= sizeof(const struct sflow_datagram_t); while (nsamples > 0 && tlen > 0) { |