From: Michael Richardson Date: Mon, 9 Mar 2015 18:23:25 +0000 (-0400) Subject: ND_TEST2 should validate that l is non-negative X-Git-Tag: tcpdump-4.7.2~1^2~3 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/10cf0bd25c92f734ae42cace8989bf3901b271fa ND_TEST2 should validate that l is non-negative --- diff --git a/netdissect.h b/netdissect.h index 4580e73d..818f8eca 100644 --- a/netdissect.h +++ b/netdissect.h @@ -271,8 +271,9 @@ struct netdissect_options { * http://www.kb.cert.org/vuls/id/162289 */ #define ND_TTEST2(var, l) \ + ((l) >= 0 && \ ((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \ - (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l)) + (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l))) /* True if "var" was captured */ #define ND_TTEST(var) ND_TTEST2(var, sizeof(var))