|
Lines 2333-2338
struct cmsghdr32 {
Link Here
|
| 2333 |
(struct cmsghdr32 *)(ctl) : \ |
2333 |
(struct cmsghdr32 *)(ctl) : \ |
| 2334 |
(struct cmsghdr32 *)NULL) |
2334 |
(struct cmsghdr32 *)NULL) |
| 2335 |
#define CMSG32_FIRSTHDR(msg) __CMSG32_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) |
2335 |
#define CMSG32_FIRSTHDR(msg) __CMSG32_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) |
|
|
2336 |
#define CMSG32_OK(ucmlen, ucmsg, mhdr) \ |
| 2337 |
((ucmlen) >= sizeof(struct cmsghdr) && \ |
| 2338 |
(ucmlen) <= (unsigned long) \ |
| 2339 |
((mhdr)->msg_controllen - \ |
| 2340 |
((char *)(ucmsg) - (char *)(mhdr)->msg_control))) |
| 2336 |
|
2341 |
|
| 2337 |
__inline__ struct cmsghdr32 *__cmsg32_nxthdr(void *__ctl, __kernel_size_t __size, |
2342 |
__inline__ struct cmsghdr32 *__cmsg32_nxthdr(void *__ctl, __kernel_size_t __size, |
| 2338 |
struct cmsghdr32 *__cmsg, int __cmsg_len) |
2343 |
struct cmsghdr32 *__cmsg, int __cmsg_len) |
|
Lines 2459-2469
static int cmsghdr_from_user32_to_kern(s
Link Here
|
| 2459 |
return -EFAULT; |
2464 |
return -EFAULT; |
| 2460 |
|
2465 |
|
| 2461 |
/* Catch bogons. */ |
2466 |
/* Catch bogons. */ |
| 2462 |
if(CMSG32_ALIGN(ucmlen) < |
2467 |
if (!CMSG32_OK(ucmlen, ucmsg, kmsg)) |
| 2463 |
CMSG32_ALIGN(sizeof(struct cmsghdr32))) |
|
|
| 2464 |
return -EINVAL; |
| 2465 |
if((unsigned long)(((char *)ucmsg - (char *)kmsg->msg_control) |
| 2466 |
+ ucmlen) > kmsg->msg_controllen) |
| 2467 |
return -EINVAL; |
2468 |
return -EINVAL; |
| 2468 |
|
2469 |
|
| 2469 |
tmp = ((ucmlen - CMSG32_ALIGN(sizeof(*ucmsg))) + |
2470 |
tmp = ((ucmlen - CMSG32_ALIGN(sizeof(*ucmsg))) + |