Re: [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen

From: Samuel Thibault
Date: Fri Apr 25 2008 - 21:56:50 EST


Michael Kerrisk, le Thu 24 Apr 2008 10:31:15 +0200, a écrit :
> > > and I see that in net/unix/af_unix.c::unix_getname() there is:
> > >
> >
> > > *uaddr_len = sizeof(short);
> >
> > I'd say that code should be fixed into using sa_family_t.
>
> Is there a patch for this?

Here it is



AF_UNIX: make unix_getname use sizeof(sunaddr->sun_family) instead of
sizeof(short).

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

--- linux/net/unix/af_unix.c.orig 2008-04-26 02:41:45.000000000 +0100
+++ linux/net/unix/af_unix.c 2008-04-26 02:42:07.000000000 +0100
@@ -1256,7 +1256,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(sunaddr->sun_family);
} 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/