sFlow: Add a length check

This commit is contained in:
Francois-Xavier Le Bail 2019-08-03 10:16:20 +02:00
parent 40f1cf8aa7
commit 09822d484b

View File

@ -872,6 +872,13 @@ sflow_print(netdissect_options *ndo,
tptr = pptr; tptr = pptr;
tlen = len; tlen = len;
sflow_datagram = (const struct sflow_datagram_t *)pptr; 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); ND_TCHECK_SIZE(sflow_datagram);
/* /*