2038. [bug] dig/nslookup/host was unlinking from wrong list

when handling errors. [RT #16122]
This commit is contained in:
Mark Andrews
2006-06-06 01:01:05 +00:00
parent 1b8d2b62ea
commit a3a5bf4df7
2 changed files with 20 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
2038. [bug] dig/nslookup/host was unlinking from wrong list
when handling errors. [RT #16122]
2037. [func] When unlinking the first or last element in a list
check that the list head points to the element to
be unlinked. [RT #15959]

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.221.2.29 2005/10/14 01:37:48 marka Exp $ */
/* $Id: dighost.c,v 1.221.2.30 2006/06/06 01:01:05 marka Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@@ -1517,12 +1517,20 @@ setup_lookup(dig_lookup_t *lookup) {
*/
static void
send_done(isc_task_t *_task, isc_event_t *event) {
isc_socketevent_t *sevent = (isc_socketevent_t *)event;
isc_buffer_t *b = NULL;
REQUIRE(event->ev_type == ISC_SOCKEVENT_SENDDONE);
UNUSED(_task);
LOCK_LOOKUP;
for (b = ISC_LIST_HEAD(sevent->bufferlist);
b != NULL;
b = ISC_LIST_HEAD(sevent->bufferlist))
ISC_LIST_DEQUEUE(sevent->bufferlist, b, link);
isc_event_free(&event);
debug("send_done()");
@@ -1832,6 +1840,10 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
recvcount--;
INSIST(recvcount >= 0);
b = ISC_LIST_HEAD(sevent->bufferlist);
INSIST(b == &query->lengthbuf);
ISC_LIST_DEQUEUE(sevent->bufferlist, b, link);
if (sevent->result == ISC_R_CANCELED) {
isc_event_free(&event);
l = query->lookup;
@@ -1857,8 +1869,6 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
UNLOCK_LOOKUP;
return;
}
b = ISC_LIST_HEAD(sevent->bufferlist);
ISC_LIST_DEQUEUE(sevent->bufferlist, &query->lengthbuf, link);
length = isc_buffer_getuint16(b);
if (length == 0) {
isc_event_free(&event);
@@ -2210,6 +2220,10 @@ recv_done(isc_task_t *task, isc_event_t *event) {
REQUIRE(event->ev_type == ISC_SOCKEVENT_RECVDONE);
sevent = (isc_socketevent_t *)event;
b = ISC_LIST_HEAD(sevent->bufferlist);
INSIST(b == &query->recvbuf);
ISC_LIST_DEQUEUE(sevent->bufferlist, &query->recvbuf, link);
if ((l->tcp_mode) && (l->timer != NULL))
isc_timer_touch(l->timer);
if ((!l->pending && !l->ns_search_only) || cancel_now) {
@@ -2243,9 +2257,6 @@ recv_done(isc_task_t *task, isc_event_t *event) {
return;
}
b = ISC_LIST_HEAD(sevent->bufferlist);
ISC_LIST_DEQUEUE(sevent->bufferlist, &query->recvbuf, link);
if (!l->tcp_mode &&
!isc_sockaddr_equal(&sevent->address, &query->sockaddr)) {
char buf1[ISC_SOCKADDR_FORMATSIZE];