+* [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>
)
{
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) {
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);
}