interface.h (281938) | interface.h (285275) |
---|---|
1/* 2 * Copyright (c) 1988-2002 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 90 unchanged lines hidden (view full) --- 99 100/* 101 * True if "l" bytes of "var" were captured. 102 * 103 * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large 104 * that "snapend - (l)" underflows. 105 * 106 * The check is for <= rather than < because "l" might be 0. | 1/* 2 * Copyright (c) 1988-2002 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 90 unchanged lines hidden (view full) --- 99 100/* 101 * True if "l" bytes of "var" were captured. 102 * 103 * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large 104 * that "snapend - (l)" underflows. 105 * 106 * The check is for <= rather than < because "l" might be 0. |
107 * 108 * We cast the pointers to uintptr_t to make sure that the compiler 109 * doesn't optimize away any of these tests (which it is allowed to 110 * do, as adding an integer to, or subtracting an integer from, a 111 * pointer assumes that the pointer is a pointer to an element of an 112 * array and that the result of the addition or subtraction yields a 113 * pointer to another member of the array, so that, for example, if 114 * you subtract a positive integer from a pointer, the result is 115 * guaranteed to be less than the original pointer value). See 116 * 117 * http://www.kb.cert.org/vuls/id/162289 |
|
107 */ | 118 */ |
108#define TTEST2(var, l) (snapend - (l) <= snapend && \ 109 (const u_char *)&(var) <= snapend - (l)) | 119#define TTEST2(var, l) \ 120 ((uintptr_t)snapend - (l) <= (uintptr_t)snapend && \ 121 (uintptr_t)&(var) <= (uintptr_t)snapend - (l)) |
110 111/* True if "var" was captured */ 112#define TTEST(var) TTEST2(var, sizeof(var)) 113 114/* Bail if "l" bytes of "var" were not captured */ 115#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc 116 117/* Bail if "var" was not captured */ --- 25 unchanged lines hidden (view full) --- 143extern void init_checksum(void); 144extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int); 145extern uint16_t create_osi_cksum(const uint8_t *, int, int); 146 147/* The printer routines. */ 148 149#include <pcap.h> 150 | 122 123/* True if "var" was captured */ 124#define TTEST(var) TTEST2(var, sizeof(var)) 125 126/* Bail if "l" bytes of "var" were not captured */ 127#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc 128 129/* Bail if "var" was not captured */ --- 25 unchanged lines hidden (view full) --- 155extern void init_checksum(void); 156extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int); 157extern uint16_t create_osi_cksum(const uint8_t *, int, int); 158 159/* The printer routines. */ 160 161#include <pcap.h> 162 |
151extern char *q922_string(const u_char *); | |
152extern char *smb_errstr(int, int); 153extern const char *nt_errstr(uint32_t); 154 155#ifdef INET6 156extern int mask62plen(const u_char *); 157#endif /*INET6*/ 158 159struct cksum_vec { --- 59 unchanged lines hidden --- | 163extern char *smb_errstr(int, int); 164extern const char *nt_errstr(uint32_t); 165 166#ifdef INET6 167extern int mask62plen(const u_char *); 168#endif /*INET6*/ 169 170struct cksum_vec { --- 59 unchanged lines hidden --- |