summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-28 16:56:22 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-28 16:56:22 +0000
commite9478ede0fae49df51be819cbe761ba96e0fc622 (patch)
tree627448c8b0a9a134cba5aeaead0aba3ae9b191da /usr.sbin/ntpd
parent3830e438390177887b924a22ac8b72d2a260d3cd (diff)
prevent unresolvable hostnames in "listen on" statements
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r--usr.sbin/ntpd/parse.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y
index 0baa4383b57..400b8d1fc67 100644
--- a/usr.sbin/ntpd/parse.y
+++ b/usr.sbin/ntpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.15 2004/07/28 16:38:43 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.16 2004/07/28 16:56:21 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -127,6 +127,13 @@ conf_main : LISTEN ON address {
struct listen_addr *la;
struct ntp_addr *h, *next;
+ if ($3->a == NULL) {
+ yyerror("cannot resolve \"%s\"", $3->name);
+ free($3->name);
+ free($3);
+ YYERROR;
+ }
+
for (h = $3->a; h != NULL; h = next) {
next = h->next;
if (h->ss.ss_family == AF_UNSPEC) {