Clément Lecigne df0bca049d net: 4 bytes kernel memory disclosure in SO_BSDCOMPAT gsopt try #2
In function sock_getsockopt() located in net/core/sock.c, optval v.val
is not correctly initialized and directly returned in userland in case
we have SO_BSDCOMPAT option set.

This dummy code should trigger the bug:

int main(void)
{
	unsigned char buf[4] = { 0, 0, 0, 0 };
	int len;
	int sock;
	sock = socket(33, 2, 2);
	getsockopt(sock, 1, SO_BSDCOMPAT, &buf, &len);
	printf("%x%x%x%x\n", buf[0], buf[1], buf[2], buf[3]);
	close(sock);
}

Here is a patch that fix this bug by initalizing v.val just after its
declaration.

Signed-off-by: Clément Lecigne <clement.lecigne@netasq.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-12 16:59:09 -08:00
..
2008-11-14 00:53:54 -08:00
2008-12-15 23:44:31 -08:00
2008-11-07 22:52:34 -08:00
2008-11-25 17:35:18 -08:00
2008-11-25 17:31:51 -08:00
2008-11-19 21:40:23 -08:00
2008-11-18 18:52:37 +11:00
2009-01-29 16:12:42 -08:00
2008-07-25 10:53:29 -07:00