mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
ForCES: Fix undefined behaviour in op_valid().
[print-forces.c:316] -> [print-forces.c:323]: (warning) Shifting 32-bit value by 32767 bits is undefined behaviour. See condition at line 323. [print-forces.c:316]: (error) Shifting by a negative value is undefined behaviour
This commit is contained in:
parent
2dfa645e86
commit
eb02553274
@ -313,12 +313,10 @@ static inline char *indent_pr(int indent, int nlpref)
|
||||
|
||||
static inline int op_valid(uint16_t op, uint16_t mask)
|
||||
{
|
||||
int opb = 1 << (op - 1);
|
||||
|
||||
if (op == 0)
|
||||
return 0;
|
||||
if (opb & mask)
|
||||
return 1;
|
||||
if (op <= F_OP_MAX)
|
||||
return (1 << (op - 1)) & mask; /* works only for 0x0001 through 0x0010 */
|
||||
/* I guess we should allow vendor operations? */
|
||||
if (op >= 0x8000)
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user