]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
#420 517/head
authordaiyunwei <daiyunwei@fnic.cn>
Tue, 3 Aug 2021 03:40:30 +0000 (11:40 +0800)
committerdaiyunwei <daiyunwei@fnic.cn>
Tue, 3 Aug 2021 03:40:30 +0000 (11:40 +0800)
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.

services/listen_dnsport.c
util/netevent.c

index 52b0a2ee9aa3058c42fa0bf7b55854d26140e1c6..b43def567501bb9174ef40a35700ad5bf746817b 100644 (file)
@@ -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 */
index d1316c5b48368841b19098d088f4d4ab3e6d9c30..a2defcb5fa3966cb0efd69be605b0f5e66e36077 100644 (file)
@@ -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));