usr/src/cmd/ntpd/Patches/cve20093563.patch
changeset 42 b6f829cb6d9e
parent 41 02f9b601daa1
child 43 394d6ad61a73
equal deleted inserted replaced
41:02f9b601daa1 42:b6f829cb6d9e
     1 --- ntpd/ntp_request.c.fcs	Thu Dec 31 15:12:40 2009
       
     2 +++ ntpd/ntp_request.c	Thu Dec 31 15:20:26 2009
       
     3 @@ -441,18 +441,20 @@
       
     4  #endif
       
     5  
       
     6  	/*
       
     7 -	 * Do some sanity checks on the packet.  Return a format
       
     8 -	 * error if it fails.
       
     9 +	 * Do some sanity checks on the packet.  Drop it if it is
       
    10 +	 * malformed or a response packet. Return a format
       
    11 +	 * error if it fails any other tests.
       
    12  	 */
       
    13 -	ec = 0;
       
    14 -	if (   (++ec, ISRESPONSE(inpkt->rm_vn_mode))
       
    15 -	    || (++ec, ISMORE(inpkt->rm_vn_mode))
       
    16 +	if (rbufp->recv_length < REQ_LEN_HDR ||
       
    17 +	    ISRESPONSE(inpkt->rm_vn_mode)) return;
       
    18 +	
       
    19 +	ec = 1;
       
    20 +	if (   (++ec, ISMORE(inpkt->rm_vn_mode))
       
    21  	    || (++ec, INFO_VERSION(inpkt->rm_vn_mode) > NTP_VERSION)
       
    22  	    || (++ec, INFO_VERSION(inpkt->rm_vn_mode) < NTP_OLDVERSION)
       
    23  	    || (++ec, INFO_SEQ(inpkt->auth_seq) != 0)
       
    24  	    || (++ec, INFO_ERR(inpkt->err_nitems) != 0)
       
    25  	    || (++ec, INFO_MBZ(inpkt->mbz_itemsize) != 0)
       
    26 -	    || (++ec, rbufp->recv_length < REQ_LEN_HDR)
       
    27  		) {
       
    28  		msyslog(LOG_ERR, "process_private: INFO_ERR_FMT: test %d failed, pkt from %s", ec, stoa(srcadr));
       
    29  		req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);