--- ntp-4.0.99k/ntpd/ntp_control.c~ Sat Jul 15 17:46:05 2000 +++ ntp-4.0.99k/ntpd/ntp_control.c Thu Apr 5 14:02:43 2001 @@ -1821,9 +1821,18 @@ while (cp < reqend && isspace((int)*cp)) cp++; - while (cp < reqend && *cp != - ',') - *tp++ = *cp++; + while (cp < reqend && *cp != ',') { + *tp++ = *cp++; + if (tp > buf + sizeof(buf)) { + msyslog(LOG_WARNING, "Attempted \"ntpdx\" exploit from IP %d.%d.%d.%d:%d (possibly spoofed)\n", + (ntohl(rmt_addr->sin_addr.s_addr) >> 24) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 16) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 8) & 0xff, + (ntohl(rmt_addr->sin_addr.s_addr) >> 0) & 0xff, + ntohs(rmt_addr->sin_port)); + return 0; + } + } if (cp < reqend) cp++; *tp = '\0';