]> The Tcpdump Group git mirrors - tcpdump/commitdiff
guard against tlen becoming very large from subtraction
authorMichael Richardson <[email protected]>
Fri, 16 Aug 2019 20:13:25 +0000 (16:13 -0400)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 27 Aug 2019 09:20:43 +0000 (11:20 +0200)
print-sflow.c

index b78fa473a0ebf71f3bb66135163ffe08f8420a00..dcaf28e8648c1dbd607a0a9ff7291b30eb19b6c1 100644 (file)
@@ -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) {