From: otto Date: Mon, 17 Apr 2017 16:03:15 +0000 (+0000) Subject: don't manipulate hdr.len, it's used internally by libutil now; ok florian@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4ffc0b90eb8e248a95746c78e7294b6052d3c0a3;p=openbsd don't manipulate hdr.len, it's used internally by libutil now; ok florian@ --- diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c index b9611c48eec..c1943243db8 100644 --- a/usr.sbin/ntpd/ntp_dns.c +++ b/usr.sbin/ntpd/ntp_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp_dns.c,v 1.19 2016/09/26 16:55:02 rzalamena Exp $ */ +/* $OpenBSD: ntp_dns.c,v 1.20 2017/04/17 16:03:15 otto Exp $ */ /* * Copyright (c) 2003-2008 Henning Brauer @@ -134,6 +134,7 @@ dns_dispatch_imsg(void) struct ntp_addr *h, *hn; struct ibuf *buf; const char *str; + size_t len; if (((n = imsg_read(ibuf_dns)) == -1 && errno != EAGAIN) || n == 0) return (-1); @@ -155,9 +156,9 @@ dns_dispatch_imsg(void) name = imsg.data; if (imsg.hdr.len < 1 + IMSG_HEADER_SIZE) fatalx("invalid %s received", str); - imsg.hdr.len -= 1 + IMSG_HEADER_SIZE; - if (name[imsg.hdr.len] != '\0' || - strlen(name) != imsg.hdr.len) + len = imsg.hdr.len - 1 - IMSG_HEADER_SIZE; + if (name[len] != '\0' || + strlen(name) != len) fatalx("invalid %s received", str); if ((cnt = host_dns(name, &hn)) == -1) break;