Submitted by: Jinmei Tatuya, Hajimu Umemoto

Reviewed by:	rwatson at freebsd dot org
Approved by:	rwatson at freebsd dot org
MFC after:	1 week

Fix the matchlen() function so that it handles the IPv4 (AF_INET)
case correctly.  Until now it has been treating IPv4 addresses
as if they were IPv6 which could lead to corruption errors.
This commit is contained in:
George V. Neville-Neil 2005-05-14 19:43:10 +00:00
parent 870739f5e6
commit fd57e549e0
2 changed files with 4 additions and 4 deletions

View File

@ -861,8 +861,8 @@ matchlen(src, dst)
break;
#endif
case AF_INET:
s = (u_char *)&((struct sockaddr_in6 *)src)->sin6_addr;
d = (u_char *)&((struct sockaddr_in6 *)dst)->sin6_addr;
s = (u_char *)&((struct sockaddr_in *)src)->sin_addr;
d = (u_char *)&((struct sockaddr_in *)dst)->sin_addr;
addrlen = sizeof(struct in_addr);
lim = s + addrlen;
break;

View File

@ -1028,8 +1028,8 @@ matchlen(src, dst)
break;
#endif
case AF_INET:
s = (u_char *)&((struct sockaddr_in6 *)src)->sin6_addr;
d = (u_char *)&((struct sockaddr_in6 *)dst)->sin6_addr;
s = (u_char *)&((struct sockaddr_in *)src)->sin_addr;
d = (u_char *)&((struct sockaddr_in *)dst)->sin_addr;
addrlen = sizeof(struct in_addr);
lim = s + addrlen;
break;