date: 2005/01/19 22:42:27;  author: mef;  state: Exp;  lines: +4 -0
Fixes CAN-2004 security reports 1016, 1017, and 1068
                                  (struct cmsghdr *)(ctl) : \
                                  (struct cmsghdr *)NULL)
 #define CMSG_FIRSTHDR(msg)     __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
+#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \
+                            (cmsg)->cmsg_len <= (unsigned long) \
+                            ((mhdr)->msg_controllen - \
+                             ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
 
 /*
  *     This mess will go away with glibc