From a5982aae1846af0a487f55f290a932c7af66dbd5 Mon Sep 17 00:00:00 2001 From: dtucker <> Date: Thu, 16 Dec 2004 00:38:59 +0000 Subject: [PATCH] Limit the number of addresses used by the 'servers' directive to 8; ok henning@ --- src/usr.sbin/ntpd/config.c | 4 ++-- src/usr.sbin/ntpd/ntpd.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c index 8646accb..bd5a49eb 100644 --- a/src/usr.sbin/ntpd/config.c +++ b/src/usr.sbin/ntpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.14 2004/08/30 12:02:59 henning Exp $ */ +/* $OpenBSD: config.c,v 1.15 2004/12/16 00:38:59 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -133,7 +133,7 @@ host_dns(const char *s, struct ntp_addr **hn) return (-1); } - for (res = res0; res; res = res->ai_next) { + for (res = res0; res && cnt < MAX_SERVERS_DNS; res = res->ai_next) { if (res->ai_family != AF_INET && res->ai_family != AF_INET6) continue; diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index 19168fe9..b6b90bcd 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.47 2004/12/09 20:24:46 mickey Exp $ */ +/* $OpenBSD: ntpd.h,v 1.48 2004/12/16 00:38:59 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -47,6 +47,8 @@ #define TRUSTLEVEL_AGRESSIVE 8 #define TRUSTLEVEL_MAX 10 +#define MAX_SERVERS_DNS 8 + #define QSCALE_OFF_MIN 0.05 #define QSCALE_OFF_MAX 0.50