tcp: check option length before d_len update
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
579934e709
commit
ef660083c8
@ -622,6 +622,16 @@ found:
|
||||
|
||||
len = (tcp->tcpoffset >> 4) << 2;
|
||||
|
||||
/* d_appdata should remove the tcp specific option field. */
|
||||
|
||||
if ((tcp->tcpoffset & 0xf0) > 0x50)
|
||||
{
|
||||
if (dev->d_len >= len)
|
||||
{
|
||||
dev->d_appdata += len - TCP_HDRLEN;
|
||||
}
|
||||
}
|
||||
|
||||
/* d_len will contain the length of the actual TCP data. This is
|
||||
* calculated by subtracting the length of the TCP header (in
|
||||
* len) and the length of the IP header.
|
||||
@ -629,17 +639,6 @@ found:
|
||||
|
||||
dev->d_len -= (len + iplen);
|
||||
|
||||
/* d_appdata should remove the tcp specific option field. */
|
||||
|
||||
if ((tcp->tcpoffset & 0xf0) > 0x50)
|
||||
{
|
||||
len = ((tcp->tcpoffset >> 4) - 5) << 2;
|
||||
if (dev->d_len >= len)
|
||||
{
|
||||
dev->d_appdata += len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the sequence number of the incoming packet is what we are
|
||||
* expecting next. If not, we send out an ACK with the correct numbers
|
||||
* in, unless we are in the SYN_RCVD state and receive a SYN, in which
|
||||
|
Loading…
Reference in New Issue
Block a user