isc_uint16_t family;
isc_uint8_t addrlen, addrbytes, scopelen;
- INSIST(isc_buffer_remaininglength(optbuf) >= 4);
+ if (isc_buffer_remaininglength(optbuf) < 4)
+ return (DNS_R_OPTERR);
family = isc_buffer_getuint16(optbuf);
addrlen = isc_buffer_getuint8(optbuf);
scopelen = isc_buffer_getuint8(optbuf);
addrbytes = (addrlen + 7) / 8;
- INSIST(isc_buffer_remaininglength(optbuf) >= addrbytes);
+ if (isc_buffer_remaininglength(optbuf) < addrbytes)
+ return (DNS_R_OPTERR);
+ ADD_STRING(target, ": ");
memset(addr, 0, sizeof(addr));
for (i = 0; i < addrbytes; i ++)
addr[i] = isc_buffer_getuint8(optbuf);
} else if (optcode == DNS_OPT_COOKIE) {
ADD_STRING(target, "; COOKIE");
} else if (optcode == DNS_OPT_CLIENT_SUBNET) {
- ADD_STRING(target, "; CLIENT-SUBNET: ");
- render_ecs(&optbuf, target);
- ADD_STRING(target, "\n");
- continue;
+ ADD_STRING(target, "; CLIENT-SUBNET");
+ result = render_ecs(&optbuf, target);
+ if (result == ISC_R_SUCCESS) {
+ ADD_STRING(target, "\n");
+ continue;
+ }
} else if (optcode == DNS_OPT_EXPIRE) {
if (optlen == 4) {
isc_uint32_t secs;
continue;
}
+ if (optcode == DNS_OPT_CLIENT_SUBNET) {
+ ADD_STRING(target, "\n");
+ continue;
+ }
+
/*
* For non-COOKIE options, add a printable
* version