mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Additional safety check for negative array index
inet_ntop result should always protect against empty string accepted without an error. Make additional check to satisfy coverity scans.
This commit is contained in:
parent
59132bd3ec
commit
656a0f076f
@ -1937,9 +1937,9 @@ inet_totext(int af, uint32_t flags, isc_region_t *src, isc_buffer_t *target) {
|
|||||||
* parsing, so append 0 in that case.
|
* parsing, so append 0 in that case.
|
||||||
*/
|
*/
|
||||||
if (af == AF_INET6 && (flags & DNS_STYLEFLAG_YAML) != 0) {
|
if (af == AF_INET6 && (flags & DNS_STYLEFLAG_YAML) != 0) {
|
||||||
isc_textregion_t tr;
|
isc_region_t r;
|
||||||
isc_buffer_usedregion(target, (isc_region_t *)&tr);
|
isc_buffer_usedregion(target, &r);
|
||||||
if (tr.base[tr.length - 1] == ':') {
|
if (r.length > 0 && r.base[r.length - 1] == ':') {
|
||||||
if (isc_buffer_availablelength(target) == 0) {
|
if (isc_buffer_availablelength(target) == 0) {
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user