Fixed the calculations with UDP header length field.

The field is in network byte order and contains the
size of the header.

Reviewed by:	brian
This commit is contained in:
Ruslan Ermilov 2000-09-21 06:52:59 +00:00
parent c508c1b632
commit 0122d6f195
2 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ AliasHandleCUSeeMeOut(struct ip *pip, struct alias_link *link)
struct udphdr *ud;
ud = (struct udphdr *)((char *)pip + (pip->ip_hl << 2));
if(ud->uh_ulen >= sizeof(struct cu_header)) {
if (ntohs(ud->uh_ulen) - sizeof(struct udphdr) >= sizeof(struct cu_header)) {
struct cu_header *cu;
struct alias_link *cu_link;
@ -104,7 +104,7 @@ AliasHandleCUSeeMeIn(struct ip *pip, struct in_addr original_addr)
cu = (struct cu_header *)(ud + 1);
oc = (struct oc_header *)(cu + 1);
ci = (struct client_info *)(oc + 1);
end = (char *)cu + ud->uh_ulen;
end = (char *)ud + ntohs(ud->uh_ulen);
if ((char *)oc <= end) {
if(cu->dest_addr)

View File

@ -70,7 +70,7 @@ AliasHandleCUSeeMeOut(struct ip *pip, struct alias_link *link)
struct udphdr *ud;
ud = (struct udphdr *)((char *)pip + (pip->ip_hl << 2));
if(ud->uh_ulen >= sizeof(struct cu_header)) {
if (ntohs(ud->uh_ulen) - sizeof(struct udphdr) >= sizeof(struct cu_header)) {
struct cu_header *cu;
struct alias_link *cu_link;
@ -104,7 +104,7 @@ AliasHandleCUSeeMeIn(struct ip *pip, struct in_addr original_addr)
cu = (struct cu_header *)(ud + 1);
oc = (struct oc_header *)(cu + 1);
ci = (struct client_info *)(oc + 1);
end = (char *)cu + ud->uh_ulen;
end = (char *)ud + ntohs(ud->uh_ulen);
if ((char *)oc <= end) {
if(cu->dest_addr)