o Calculate a number of bytes to copy (cnt) correctly:

+----+-+-+-+-+----+----+- - - - - - - - - - - -  -+----+
  |    | |C| | |    |    |                          |    |
  | IP |N|O|L|P|    | IP |                          | IP |
  | #1 |O|D|E|T|    | #2 |                          | #n |
  |    |P|E|N|R|    |    |                          |    |
  +----+-+-+-+-+----+----+- - - - - - - - - - - -  -+----+
               ^    ^<---- cnt - (IPOPT_MINOFF - 1) ---->|
               |    |
src            |    +-- cp[IPOPT_OFF + 1] + sizeof(struct in_addr)
               |
dst            +-- cp[IPOPT_OFF + 1]

PR:		kern/66386
Submitted by:	Andrei Iltchenko
MFC after:	3 weeks
This commit is contained in:
Maxim Konovalov 2004-05-11 19:14:44 +00:00
parent cbb58e9c9a
commit a49b21371a

View File

@ -1735,7 +1735,7 @@ ip_pcbopts(optname, pcbopt, m)
*/
bcopy((&cp[IPOPT_OFFSET+1] + sizeof(struct in_addr)),
&cp[IPOPT_OFFSET+1],
(unsigned)cnt + sizeof(struct in_addr));
(unsigned)cnt - (IPOPT_MINOFF - 1));
break;
}
}