$NetBSD: patch-aa,v 1.3 2001/04/06 15:21:06 fredb Exp $ --- ntpd/ntp_control.c 2000/04/22 14:53:15 1.1.1.2 +++ ntpd/ntp_control.c 2001/04/05 09:45:27 1.1.1.2.4.1 @@ -1812,9 +1812,22 @@ while (cp < reqend && isspace((int)*cp)) cp++; - while (cp < reqend && *cp != - ',') + while (cp < reqend && *cp != ',') { *tp++ = *cp++; + if (tp >= + buf + sizeof(buf) - 1) { +#if 0 /* don't syslog for now - DoS potential on filling syslog */ + 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)); +#endif + return (0); + } + } if (cp < reqend) cp++; *tp = '\0';