[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091023214306.GA30616@lenovo>
Date: Sat, 24 Oct 2009 01:43:06 +0400
From: Cyrill Gorcunov <gorcunov@...il.com>
To: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [RFC] net,socket: introduce build_sockaddr_check helper to
catch overflow at build time
[Cyrill Gorcunov - Thu, Oct 22, 2009 at 05:55:57PM +0400]
...
|
| 2) All handlers set *len to some size explicitly so we may
| introduce set_sockaddr_size() helper like
|
| #define set_sockaddr_size(ptr, size) \
| do { \
| build_sockaddr_check(size); \
| *ptr = size; \
| } while (0)
|
| Or you meant something completely different?
|
| -- Cyrill
Or say it could be something like that
#define __sockaddr(type, src) \
({ build_sockaddr_check(sizeof(type)); (type *) src; })
and say in function af_inet.c:inet_getname instead of
struct sockaddr_in *sin = (struct sockaddr_in *)uaddr;
we may write like
struct sockaddr_in *sin = __sockaddr(struct sockaddr_in, uaddr);
which would check the size.
-- Cyrill
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists