Skip to content

Commit faf869c

Browse files
committed
TCP Option 0 should participate in bitmask too
Fixes: a1386af ("tcp options: fix possible shift-out-of-bounds") Signed-off-by: ABC <abc@openwall.com>
1 parent a1386af commit faf869c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ipt_NETFLOW.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4852,12 +4852,10 @@ static inline __u32 tcp_options(const struct sk_buff *skb, const unsigned int pt
48524852
for (i = 0; likely(i < optsize); ) {
48534853
u_int8_t opt = p[i++];
48544854

4855+
if (likely(opt < 32))
4856+
ret |= 1 << (31 - opt);
48554857
if (likely(opt == 0) || unlikely(p[i] < 2))
48564858
break;
4857-
if (likely(opt < 32)) {
4858-
/* IANA doc is messed up, see above. */
4859-
ret |= 1 << (31 - opt);
4860-
}
48614859
if (unlikely(opt == 1))
48624860
continue;
48634861
else

0 commit comments

Comments
 (0)