mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 02:23:27 +08:00
netdissect.h: Update ND_TTEST2 to fix issue 443
Add IS_NOT_NEGATIVE macro. Avoid these warnings: - comparison of unsigned expression >= 0 is always true [-Wtype-limits], - comparison is always true due to limited range of data type [-Wtype-limits].
This commit is contained in:
parent
599b0311e0
commit
cab33b7a0a
@ -270,8 +270,11 @@ struct netdissect_options {
|
||||
*
|
||||
* http://www.kb.cert.org/vuls/id/162289
|
||||
*/
|
||||
|
||||
#define IS_NOT_NEGATIVE(x) (((x) > 0) || ((x) == 0))
|
||||
|
||||
#define ND_TTEST2(var, l) \
|
||||
((l) >= 0 && \
|
||||
(IS_NOT_NEGATIVE(l) && \
|
||||
((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \
|
||||
(uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user