Browse Source

don't check for a return value that host() doesn't return, so future

generations don't try to change any of the values and break the code.
ok deraadt
OPENBSD_5_7
tedu 9 years ago
parent
commit
ff1d6653e1
3 changed files with 7 additions and 15 deletions
  1. +3
    -5
      src/usr.sbin/ntpd/config.c
  2. +2
    -2
      src/usr.sbin/ntpd/ntpd.h
  3. +2
    -8
      src/usr.sbin/ntpd/parse.y

+ 3
- 5
src/usr.sbin/ntpd/config.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: config.c,v 1.21 2015/01/10 01:56:52 bcook Exp $ */
/* $OpenBSD: config.c,v 1.22 2015/01/10 13:47:05 tedu Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -36,7 +36,7 @@ struct ntp_addr *host_v6(const char *);
static u_int32_t maxid = 0;
int
void
host(const char *s, struct ntp_addr **hn)
{
struct ntp_addr *h = NULL;
@ -54,11 +54,9 @@ host(const char *s, struct ntp_addr **hn)
h = host_v6(s);
if (h == NULL)
return (0);
return;
*hn = h;
return (1);
}
struct ntp_addr *


+ 2
- 2
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.115 2015/01/09 07:35:37 deraadt Exp $ */
/* $OpenBSD: ntpd.h,v 1.116 2015/01/10 13:47:05 tedu Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -279,7 +279,7 @@ extern struct ctl_conns ctl_conns;
int parse_config(const char *, struct ntpd_conf *);
/* config.c */
int host(const char *, struct ntp_addr **);
void host(const char *, struct ntp_addr **);
int host_dns(const char *, struct ntp_addr **);
struct ntp_peer *new_peer(void);
struct ntp_conf_sensor *new_sensor(char *);


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

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.56 2015/01/08 00:30:08 bcook Exp $ */
/* $OpenBSD: parse.y,v 1.57 2015/01/10 13:47:05 tedu Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -225,13 +225,7 @@ address : STRING {
if (($$ = calloc(1, sizeof(struct ntp_addr_wrap))) ==
NULL)
fatal(NULL);
if (host($1, &$$->a) == -1) {
yyerror("could not parse address spec \"%s\"",
$1);
free($1);
free($$);
YYERROR;
}
host($1, &$$->a);
$$->name = $1;
}
;


Loading…
Cancel
Save