]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1887] DNS fails on 4.2.7p153 using threads.
authorDave Hart <hart@ntp.org>
Sat, 16 Apr 2011 18:14:13 +0000 (18:14 +0000)
committerDave Hart <hart@ntp.org>
Sat, 16 Apr 2011 18:14:13 +0000 (18:14 +0000)
bk: 4da9dc75fWyR7ZJMVo71w5TtVZiT5Q

ChangeLog
libntp/work_thread.c

index 15fa2ef2794f56ba9035a4681f07b1301bdd7c35..c601ebf4a79d933b13d41a4fe8fffafe20a128d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1887] DNS fails on 4.2.7p153 using threads.
 (4.2.7p153) 2011/04/16 Released by Harlan Stenn <stenn@ntp.org>
 * A few more Coverity Scan cleanups.
 (4.2.7p152) 2011/04/15 Released by Harlan Stenn <stenn@ntp.org>
index 562eb049351c6a4dd8087cf988cf4ac088a6dd4b..ea471c26fb06b33f027ff8d89c0e0777d4cf1633 100644 (file)
@@ -203,13 +203,15 @@ send_blocking_req_internal(
        )
 {
        blocking_pipe_header *  threadcopy;
+       size_t                  payload_octets;
 
        REQUIRE(hdr != NULL);
        REQUIRE(data != NULL);
        DEBUG_REQUIRE(BLOCKING_REQ_MAGIC == hdr->magic_sig);
 
-       if (sizeof(*hdr) < hdr->octets)
+       if (hdr->octets <= sizeof(*hdr))
                return 1;       /* failure */
+       payload_octets = hdr->octets - sizeof(*hdr);
 
        ensure_workitems_empty_slot(c);
        if (NULL == c->thread_ref) {
@@ -219,8 +221,7 @@ send_blocking_req_internal(
 
        threadcopy = emalloc(hdr->octets);
        memcpy(threadcopy, hdr, sizeof(*hdr));
-       memcpy((char *)threadcopy + sizeof(*hdr),
-              data, hdr->octets - sizeof(*hdr));
+       memcpy((char *)threadcopy + sizeof(*hdr), data, payload_octets);
 
        return queue_req_pointer(c, threadcopy);
 }