From: Artem Boldariev Date: Mon, 14 Jun 2021 20:25:03 +0000 (+0300) Subject: Fix ASAN error in DoH (passing NULL to memmove()) X-Git-Tag: v9.17.16~36^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=dc356bb1965161e6e293a2b4ef0ec6b0fa33de51;p=thirdparty%2Fbind9.git Fix ASAN error in DoH (passing NULL to memmove()) The warning was produced by an ASAN build: runtime error: null pointer passed as argument 2, which is declared to never be null This commit fixes it by checking if nghttp2_session_mem_send() has actually returned anything. --- diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index c04cb9e9d1b..f22f537d4ec 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -1025,6 +1025,13 @@ http_send_outgoing(isc_nm_http_session_t *session, isc_nmhandle_t *httphandle, nghttp2_session_mem_send(session->ngsession, &data); const size_t new_total = total + pending; + /* Sometimes nghttp2_session_mem_send() does not return any + * data to send even though nghttp2_session_want_write() + * returns success. */ + if (pending == 0 || data == NULL) { + break; + } + /* reallocate buffer if required */ if (new_total > sizeof(tmp_data)) { uint8_t *old_prepared_data = prepared_data;