]> git.ipfire.org Git - thirdparty/bind9.git/commit
Prevent overflow of bufsize
authorMark Andrews <marka@isc.org>
Tue, 9 Jul 2024 01:55:46 +0000 (11:55 +1000)
committerMark Andrews <marka@isc.org>
Sun, 4 Aug 2024 23:52:20 +0000 (23:52 +0000)
commit0dbda6661dcc45d203906b4d960b0977bcec4051
tree165bf2fac0b3789325ee0252924393212d87ad8f
parent02cb4823db09c940c46cd77cbaf19d1137efcd9c
Prevent overflow of bufsize

If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }

(cherry picked from commit 20ac13fb234f9bca37fe8b86910df805779a7621)
bin/dig/host.c