LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
@ 2008-03-08  2:23 Samuel Thibault
  2008-03-24  4:56 ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Samuel Thibault @ 2008-03-08  2:23 UTC (permalink / raw)
  To: linux-kernel, akpm

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@ens-lyon.org>

--- 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;
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-05-12 14:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-08  2:23 [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen Samuel Thibault
2008-03-24  4:56 ` David Miller
2008-03-24 10:43   ` Samuel Thibault
2008-03-24 11:50     ` Andi Kleen
2008-03-24 12:17       ` Samuel Thibault
2008-03-24 12:27         ` Samuel Thibault
2008-03-31  4:00           ` Michael Kerrisk
2008-03-31  9:44             ` Samuel Thibault
2008-03-31 18:51               ` Michael Kerrisk
2008-04-18 16:52             ` Michael Kerrisk
2008-04-24  0:16               ` Samuel Thibault
2008-04-24  8:31                 ` Michael Kerrisk
2008-04-26  1:44                   ` Samuel Thibault
2008-04-27  5:54                     ` David Miller
2008-05-12 13:10                       ` Michael Kerrisk
2008-05-12 13:20                         ` Samuel Thibault
2008-03-24 20:23     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).