On Fri, Jan 9, 2015 at 3:45 PM, Brent Cook <[email protected]> wrote:
> From: Brent Cook <[email protected]>
>
> client_nextaddr() dereferences p->addr looking for a loop. Don't call it
> if p->addr is NULL. Maybe the NULL check belongs directly in
> client_nextaddr()? If not, is this ok?
Bah, I screwed this one up - please ignore it.
> ---
> src/usr.sbin/ntpd/client.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
> index 115f543..524a199 100644
> --- a/src/usr.sbin/ntpd/client.c
> +++ b/src/usr.sbin/ntpd/client.c
> @@ -126,7 +126,7 @@ client_query(struct ntp_peer *p)
> {
> int val;
>
> - if (p->addr == NULL && client_nextaddr(p) == -1) {
> + if (p->addr == NULL || client_nextaddr(p) == -1) {
> set_next(p, MAXIMUM(SETTIME_TIMEOUT,
> scale_interval(INTERVAL_QUERY_AGGRESSIVE)));
> return (0);
> --
> 1.9.1
>