1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Fix bug in dealing with "hlen == 1 and opt > 1"

This commit is contained in:
Darren Reed 2000-05-09 23:35:24 +00:00
parent e0ab5cb523
commit 68b16578ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=60295

View File

@ -285,13 +285,19 @@ fr_info_t *fin;
} }
for (s = (u_char *)(ip + 1), hlen -= (int)sizeof(*ip); hlen; ) { for (s = (u_char *)(ip + 1), hlen -= (int)sizeof(*ip); hlen > 0; ) {
opt = *s; opt = *s;
if (opt == '\0') if (opt == '\0')
break; break;
ol = (opt == IPOPT_NOP) ? 1 : (int)*(s+1); else if (opt == IPOPT_NOP)
if (opt > 1 && (ol < 2 || ol > hlen)) ol = 1;
break; else {
if (hlen < 2)
break;
ol = (int)*(s + 1);
if (ol < 2 || ol > hlen)
break;
}
for (i = 9, mv = 4; mv >= 0; ) { for (i = 9, mv = 4; mv >= 0; ) {
op = ipopts + i; op = ipopts + i;
if (opt == (u_char)op->ol_val) { if (opt == (u_char)op->ol_val) {