NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/38992: CMSG_* fun



The following reply was made to PR kern/38992; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/38992: CMSG_* fun
Date: Fri, 20 Jun 2008 10:57:27 +0200

 --SLDf9lqlvOQaIe6s
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 This check should be added to take care of the "proceeds happily"
 part.
 
 Martin
 
 --SLDf9lqlvOQaIe6s
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch
 
 Index: uipc_usrreq.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/uipc_usrreq.c,v
 retrieving revision 1.115
 diff -u -r1.115 uipc_usrreq.c
 --- uipc_usrreq.c      10 Jun 2008 11:49:11 -0000      1.115
 +++ uipc_usrreq.c      20 Jun 2008 08:47:55 -0000
 @@ -1299,6 +1299,9 @@
         * a reference to each.
         */
        nfds = (cm->cmsg_len - CMSG_ALIGN(sizeof(*cm))) / sizeof(int);
 +      if (nfds <= 0)
 +              return EINVAL;
 +
        fdp = (int *)CMSG_DATA(cm);
        for (i = 0; i < nfds; i++) {
                fd = *fdp++;
 
 --SLDf9lqlvOQaIe6s--
 


Home | Main Index | Thread Index | Old Index