]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sflow.c
Handle very large -f files by rejecting them.
[tcpdump] / print-sflow.c
index 41828d4206ec6d8ece9c72e39d3f886ddf52ef9f..dcaf28e8648c1dbd607a0a9ff7291b30eb19b6c1 100644 (file)
@@ -884,7 +884,7 @@ sflow_print(netdissect_options *ndo,
     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 < %" PRIsize "]",
+        ND_PRINT((ndo, " [length %u < %zu]",
                   len, sizeof(struct sflow_datagram_t)));
         ND_PRINT((ndo, " (invalid)"));
         return;
@@ -924,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) {