From c138dacf0cfab71856dbdc3a17fafb8d56f55dca Mon Sep 17 00:00:00 2001 From: gnn Date: Sat, 14 May 2005 19:43:10 +0000 Subject: 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. --- lib/libc/net/getaddrinfo.c | 4 ++-- lib/libc/net/name6.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index d6def63..a7ab128 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -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; diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 4bbc5f0..611dea7 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -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; -- cgit v1.1