]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix an abort in DoH (client-side) when writing on closing sock
authorArtem Boldariev <artem@boldariev.com>
Tue, 10 May 2022 16:46:12 +0000 (19:46 +0300)
committerArtem Boldariev <artem@boldariev.com>
Fri, 20 May 2022 17:18:40 +0000 (20:18 +0300)
The commit fixes a corner case in client-side DoH code, when a write
attempt is done on a closing socket (session).

The change ensures that the write call-back will be called with a
proper error code (see failed_send_cb() call in client_httpsend()).

lib/isc/netmgr/http.c

index a787e2d31023286d9b58aa8fd5e722e72c6b7bcc..4cde316236c7f2bdcf9d1771c44dcac0cd4dc11b 100644 (file)
@@ -1509,7 +1509,12 @@ client_send(isc_nmhandle_t *handle, const isc_region_t *region) {
        REQUIRE(region != NULL);
        REQUIRE(region->base != NULL);
        REQUIRE(region->length <= MAX_DNS_MESSAGE_SIZE);
-       REQUIRE(cstream != NULL);
+
+       if (session->closed) {
+               return (ISC_R_CANCELED);
+       }
+
+       INSIST(cstream != NULL);
 
        if (cstream->post) {
                /* POST */