summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/interface.h
diff options
context:
space:
mode:
authorpkelsey <pkelsey@FreeBSD.org>2015-07-08 16:19:32 +0000
committerpkelsey <pkelsey@FreeBSD.org>2015-07-08 16:19:32 +0000
commit7e965066ede451d7a551dd68d6c59acf32e4846e (patch)
treef0c2243cc0a2a59f3eb1354ba3987d4cbcb788bc /contrib/tcpdump/interface.h
parent732211dc794db586649eabfc1d517b8a477440f5 (diff)
parentc2704d8ede887d9fe69a9a11fe0755b09ec6895d (diff)
downloadFreeBSD-src-7e965066ede451d7a551dd68d6c59acf32e4846e.zip
FreeBSD-src-7e965066ede451d7a551dd68d6c59acf32e4846e.tar.gz
MFV r285191: tcpdump 4.7.4.
Also, the changes made in r272451 and r272653 that were lost in the merge of 4.6.2 (r276788) have been restored. PR: 199568 Differential Revision: https://reviews.freebsd.org/D3007 Reviewed by: brooks, hiren Approved by: jmallett (mentor) MFC after: 1 month
Diffstat (limited to 'contrib/tcpdump/interface.h')
-rw-r--r--contrib/tcpdump/interface.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h
index 299d010..59c1eef 100644
--- a/contrib/tcpdump/interface.h
+++ b/contrib/tcpdump/interface.h
@@ -104,9 +104,21 @@ extern int32_t thiszone; /* seconds offset from gmt to local time */
* that "snapend - (l)" underflows.
*
* The check is for <= rather than < because "l" might be 0.
+ *
+ * We cast the pointers to uintptr_t to make sure that the compiler
+ * doesn't optimize away any of these tests (which it is allowed to
+ * do, as adding an integer to, or subtracting an integer from, a
+ * pointer assumes that the pointer is a pointer to an element of an
+ * array and that the result of the addition or subtraction yields a
+ * pointer to another member of the array, so that, for example, if
+ * you subtract a positive integer from a pointer, the result is
+ * guaranteed to be less than the original pointer value). See
+ *
+ * http://www.kb.cert.org/vuls/id/162289
*/
-#define TTEST2(var, l) (snapend - (l) <= snapend && \
- (const u_char *)&(var) <= snapend - (l))
+#define TTEST2(var, l) \
+ ((uintptr_t)snapend - (l) <= (uintptr_t)snapend && \
+ (uintptr_t)&(var) <= (uintptr_t)snapend - (l))
/* True if "var" was captured */
#define TTEST(var) TTEST2(var, sizeof(var))
@@ -148,7 +160,6 @@ extern uint16_t create_osi_cksum(const uint8_t *, int, int);
#include <pcap.h>
-extern char *q922_string(const u_char *);
extern char *smb_errstr(int, int);
extern const char *nt_errstr(uint32_t);
OpenPOWER on IntegriCloud