[PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
- From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
- Date: Sat, 8 Mar 2008 02:23:21 +0000
Hello,
Accept and getpeername are supposed to return the amount of bytes
written in the returned address. However, on unnamed sockets, only
sizeof(short) is returned, while a 0 is put in the sun_path member.
This patch adds 1 for that additional byte.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
--- linux/net/unix/af_unix.c.orig 2008-03-08 02:17:40.000000000 +0000
+++ linux/net/unix/af_unix.c 2008-03-08 02:17:54.000000000 +0000
@@ -1274,7 +1274,7 @@ static int unix_getname(struct socket *s
if (!u->addr) {
sunaddr->sun_family = AF_UNIX;
sunaddr->sun_path[0] = 0;
- *uaddr_len = sizeof(short);
+ *uaddr_len = sizeof(short) + 1;
} else {
struct unix_address *addr = u->addr;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
- From: David Miller
- Re: [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
- Prev by Date: Re: [patch -mm 2/2] mempolicy: use default_policy mode instead of MPOL_DEFAULT
- Next by Date: Re: [PATCH] [5/13] Add mask allocator statistics to vmstat.[ch]
- Previous by thread: Question about pdflush's two ratio?
- Next by thread: Re: [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
- Index(es):