Browse Source

prevent unresolvable hostnames in "listen on" statements

OPENBSD_3_6
henning 20 years ago
parent
commit
a155754361
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/usr.sbin/ntpd/parse.y

+ 8
- 1
src/usr.sbin/ntpd/parse.y View File

@ -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> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -127,6 +127,13 @@ conf_main : LISTEN ON address {
struct listen_addr *la; struct listen_addr *la;
struct ntp_addr *h, *next; 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) { for (h = $3->a; h != NULL; h = next) {
next = h->next; next = h->next;
if (h->ss.ss_family == AF_UNSPEC) { if (h->ss.ss_family == AF_UNSPEC) {


Loading…
Cancel
Save