diff -ruN linux.orig/net/core/scm.c linux/net/core/scm.c --- linux.orig/net/core/scm.c Thu Apr 22 19:45:19 1999 +++ linux/net/core/scm.c Sat Nov 4 17:19:34 2000 @@ -210,12 +210,16 @@ { struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control; - int fdmax = (msg->msg_controllen - sizeof(struct cmsghdr))/sizeof(int); + int fdmax = 0; int fdnum = scm->fp->count; struct file **fp = scm->fp->fp; int *cmfptr; int err = 0, i; + if (msg->msg_controllen > sizeof(struct cmsghdr)) + fdmax = (msg->msg_controllen - sizeof(struct cmsghdr)) + /sizeof(int); + if (fdnum < fdmax) fdmax = fdnum; @@ -251,7 +255,7 @@ msg->msg_controllen -= cmlen; } } - if (i < fdnum) + if (i < fdnum || (fdnum && fdmax == 0)) msg->msg_flags |= MSG_CTRUNC; /*