summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-10-06 21:55:05 +0000
committerjkim <jkim@FreeBSD.org>2011-10-06 21:55:05 +0000
commitf3e29d548396db158b981d33b8e7affeac709ae3 (patch)
tree8699a1c6ee6fb9cd905a4413bac56736e217f0f9 /sys/compat
parent5bf71ef7d883aec32fe869b288317533e4324d3e (diff)
downloadFreeBSD-src-f3e29d548396db158b981d33b8e7affeac709ae3.zip
FreeBSD-src-f3e29d548396db158b981d33b8e7affeac709ae3.tar.gz
Use the caculated length instead of maximum length.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 7462ca3..431c5b9 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -166,11 +166,11 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int salen)
namelen = strnlen(name + 1, salen - hdrlen - 1) + 1;
} else
namelen = strnlen(name, salen - hdrlen);
- if (hdrlen + namelen > sizeof(struct sockaddr_un)) {
+ salen = hdrlen + namelen;
+ if (salen > sizeof(struct sockaddr_un)) {
error = ENAMETOOLONG;
goto out;
}
- salen = sizeof(struct sockaddr_un);
}
sa = (struct sockaddr *)kosa;
OpenPOWER on IntegriCloud