ip/tinc: handle single byte noop and end-of-option-list tcp options in clampmss()
This commit is contained in:
parent
15ff38e818
commit
0affe02b61
1 changed files with 12 additions and 1 deletions
|
@ -970,9 +970,20 @@ clampmss(Host *d, uchar *p, int n, int o)
|
||||||
return;
|
return;
|
||||||
if((e = p+(p[12]>>4)*4) > p+n)
|
if((e = p+(p[12]>>4)*4) > p+n)
|
||||||
return;
|
return;
|
||||||
for(h = p+TcpHdr; h+4 <= e && h[1] > 0; h += h[1])
|
for(h = p+TcpHdr; h < e;){
|
||||||
|
switch(h[0]){
|
||||||
|
case 0:
|
||||||
|
return;
|
||||||
|
case 1:
|
||||||
|
h++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(h[1] < 2 || h[1] > e - h)
|
||||||
|
return;
|
||||||
if(h[0] == 2 && h[1] == 4)
|
if(h[0] == 2 && h[1] == 4)
|
||||||
goto Found;
|
goto Found;
|
||||||
|
h += h[1];
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
Found:
|
Found:
|
||||||
oldmss = h[2]<<8 | h[3];
|
oldmss = h[2]<<8 | h[3];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue