From: Brent Cook <bust...@gmail.com>

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?

---
 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

Reply via email to