+2001-06-08 Harlan Stenn <stenn@whimsy.udel.edu>
+
+ * configure.in: 4.0.99m-rc1b
+
+ * ntpd/refclock_true.c (true_debug): Bump some buffer sizes to
+ reduce/eliminate chance of buffer overflow. Use snprintf()
+ instead of sprintf(). Do a better job of opening the debug file.
+ * ntpd/ntp_control.c (ctl_getitem): Count overflow packets as bad
+ and return a BADFMT.
+ * ntpd/ntp_config.c (save_resolve): call fdopen() with the correct
+ mode.
+ From: Bela Lubkin <belal@sco.com>
+
2001-06-03 Harlan Stenn <stenn@whimsy.udel.edu>
* include/ntp.h (RES_ALLFLAGS): Add RES_DEMOBILIZE.
# Define the identity of the package.
PACKAGE=ntp
-VERSION=4.0.99m-rc1a
+VERSION=4.0.99m-rc1b
cat >>confdefs.h <<EOF
#define PACKAGE "$PACKAGE"
AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target")
AM_CONFIG_HEADER(config.h)
AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE(ntp, 4.0.99m-rc1a)
+AM_INIT_AUTOMAKE(ntp, 4.0.99m-rc1b)
AC_PREREQ(2.49)
ac_cv_var_oncore_ok=no
res_fp = NULL;
if ((fd = mkstemp(res_file)) != -1)
- res_fp = fdopen(fd, "w");
+ res_fp = fdopen(fd, "r+");
}
#else
(void) mktemp(res_file);
while (cp < reqend && *cp != ',') {
*tp++ = *cp++;
if (tp >= buf + sizeof(buf)) {
+ ctl_error(CERR_BADFMT);
+ numctlbadpkts++;
msyslog(LOG_WARNING,
"Possible 'ntpdx' exploit from %s:%d (possibly spoofed)\n",
inet_ntoa(rmt_addr->sin_addr), ntohs(rmt_addr->sin_port)
if (want_debugging != now_debugging)
{
if (want_debugging) {
- char filename[20];
+ char filename[40];
+ int fd;
- sprintf(filename, "/tmp/true%d.debug", up->unit);
- up->debug = fopen(filename, "w");
- if (up->debug) {
+ snprintf(filename, sizeof(filename), "/tmp/true%d.debug", up->unit);
+ fd = open(filename, O_CREAT | O_WRONLY | O_EXCL, 0600);
+ if (fd >= 0 && (up->debug = fdopen(fd, "r+"))) {
#ifdef HAVE_SETVBUF
static char buf[BUFSIZ];
setvbuf(up->debug, buf, _IOLBF, BUFSIZ);
{
register struct true_unit *up;
struct refclockproc *pp;
- char device[20];
+ char device[40];
int fd;
/*
* Open serial port
*/
- (void)sprintf(device, DEVICE, unit);
+ (void)snprintf(device, sizeof(device), DEVICE, unit);
if (!(fd = refclock_open(device, SPEED232, LDISC_CLK)))
return (0);