From: daiyunwei Date: Tue, 3 Aug 2021 03:40:30 +0000 (+0800) Subject: #420 X-Git-Tag: release-1.13.2rc1~15^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F517%2Fhead;p=thirdparty%2Funbound.git #420 clear the c->buffer in the comm_point_send_reply does resolve the "can't fit qbuffer in c->buffer" issue, but it breaks the mesh reply list function that need to reuse the answer. because the c->buffer is cleared in the comm_point_send_reply, it cannot be resued again. it means that it is not inappropriate to clear c->buffer in the comm_point_send_reply. After some investigation, i found it is appropriate to clear c->buffer before use in the http2_query_read_done. --- diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index 52b0a2ee9..b43def567 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -2477,6 +2477,10 @@ static int http2_query_read_done(struct http2_session* h2_session, "buffer already assigned to stream"); return -1; } + + /* the c->buffer might be used by mesh_send_reply and no be cleard + * need to be cleared before use */ + sldns_buffer_clear(h2_session->c->buffer); if(sldns_buffer_remaining(h2_session->c->buffer) < sldns_buffer_remaining(h2_stream->qbuffer)) { /* qbuffer will be free'd in frame close cb */ diff --git a/util/netevent.c b/util/netevent.c index d1316c5b4..a2defcb5f 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -4063,7 +4063,6 @@ comm_point_send_reply(struct comm_reply *repinfo) } repinfo->c->h2_stream = NULL; repinfo->c->tcp_is_reading = 0; - sldns_buffer_clear(repinfo->c->buffer); comm_point_stop_listening(repinfo->c); comm_point_start_listening(repinfo->c, -1, adjusted_tcp_timeout(repinfo->c));