[9.20] fix: dev: CID 498025 and CID 498031: Overflowed constant INTEGER_OVERFLOW
Add INSIST to fail if the multiplication would cause the variables to overflow. Closes #4798 Backport of MR !9131 Merge branch 'backport-4798-cid-498025-and-cid-498031-overflowed-constant-integer_overflow-9.20' into 'bind-9.20' See merge request isc-projects/bind9!9229
This commit is contained in:
@@ -183,6 +183,7 @@ retry:
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
isc_buffer_free(&b);
|
||||
INSIST(bufsize <= (UINT_MAX / 2));
|
||||
bufsize *= 2;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ printrdata(dns_rdata_t *rdata) {
|
||||
check_result(result, "dns_rdata_totext");
|
||||
}
|
||||
isc_buffer_free(&b);
|
||||
INSIST(size <= (UINT_MAX / 2));
|
||||
size *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user