]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Silence tainted scalar in client.c
authorMark Andrews <marka@isc.org>
Wed, 28 May 2025 23:42:08 +0000 (09:42 +1000)
committerMark Andrews <marka@isc.org>
Thu, 29 May 2025 06:26:37 +0000 (06:26 +0000)
Coverity detected that 'optlen' was not being checked in 'process_opt'.
This is actually already done when the OPT record was initially
parsed.  Add an INSIST to silence Coverity as is done in message.c.

lib/ns/client.c

index cdc5a49e094783bc6fc914a206b7c59933969fe5..87e79e13330917060accab7ec3d99c18ec7f22b9 100644 (file)
@@ -1589,6 +1589,9 @@ process_opt(ns_client_t *client, dns_rdataset_t *opt) {
                while (isc_buffer_remaininglength(&optbuf) >= 4) {
                        optcode = isc_buffer_getuint16(&optbuf);
                        optlen = isc_buffer_getuint16(&optbuf);
+
+                       INSIST(isc_buffer_remaininglength(&optbuf) >= optlen);
+
                        /*
                         * When returning BADVERSION, only process
                         * DNS_OPT_NSID or DNS_OPT_COOKIE options.