Commit 69334949 authored by David S. Miller's avatar David S. Miller

[AF_UNIX]: Remove spurious len test in unix_mkname.

Noticed by James Antill <james-linux-kernel@and.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a72fbe2
......@@ -187,18 +187,7 @@ static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp)
return -EINVAL;
if (!sunaddr || sunaddr->sun_family != AF_UNIX)
return -EINVAL;
if (sunaddr->sun_path[0])
{
/*
* This may look like an off by one error but it is
* a bit more subtle. 108 is the longest valid AF_UNIX
* path for a binding. sun_path[108] doesn't as such
* exist. However in kernel space we are guaranteed that
* it is a valid memory location in our kernel
* address buffer.
*/
if (len > sizeof(*sunaddr))
len = sizeof(*sunaddr);
if (sunaddr->sun_path[0]) {
((char *)sunaddr)[len]=0;
len = strlen(sunaddr->sun_path)+1+sizeof(short);
return len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment