Re: [PATCH] Fix getsockopt(SO_PEERNAME) buffer size against potential future buffer overflow

From: David Miller
Date: Tue Sep 30 2014 - 00:59:56 EST

From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Date: Sun, 28 Sep 2014 15:55:45 +0200

> In net/core/sock.c's sock_getsockopt, the address buffer size is
> hardcoded to 128. It happens that sizeof(struct sockaddr_storage) is
> indeed 128, but that is just luck and would probably not get updated
> whenever sockaddr_storage would grow. This patch makes it simply use
> sockaddr_storage instead.
> Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

sockaddr_storage's size is a user exported API and therefore can
never, ever, change.

If you want to change 128 to _K_SS_MAXSIZE or similar, fine.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at