diff options
Diffstat (limited to 'usr.sbin/bind')
-rw-r--r-- | usr.sbin/bind/lib/dns/masterdump.c | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/name.c | 5 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/rdata.c | 2 | ||||
-rw-r--r-- | usr.sbin/bind/lib/dns/sec/dst/dst_api.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/lwres/gethost.c | 19 | ||||
-rw-r--r-- | usr.sbin/bind/lib/lwres/lwinetntop.c | 2 |
6 files changed, 23 insertions, 11 deletions
diff --git a/usr.sbin/bind/lib/dns/masterdump.c b/usr.sbin/bind/lib/dns/masterdump.c index e52f5631824..1cd5bf433b8 100644 --- a/usr.sbin/bind/lib/dns/masterdump.c +++ b/usr.sbin/bind/lib/dns/masterdump.c @@ -397,7 +397,7 @@ rdataset_totext(dns_rdataset_t *rdataset, INDENT_TO(ttl_column); length = snprintf(ttlbuf, sizeof(ttlbuf), "%u", rdataset->ttl); - INSIST(length <= sizeof ttlbuf); + INSIST(length < sizeof ttlbuf); isc_buffer_availableregion(target, &r); if (r.length < length) return (ISC_R_NOSPACE); diff --git a/usr.sbin/bind/lib/dns/name.c b/usr.sbin/bind/lib/dns/name.c index 08c25ff2bb9..7c33c99fb3e 100644 --- a/usr.sbin/bind/lib/dns/name.c +++ b/usr.sbin/bind/lib/dns/name.c @@ -1785,9 +1785,8 @@ dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot, char buf[5]; if (trem < 4) return (ISC_R_NOSPACE); - snprintf(buf, sizeof(buf), + snprintf(tdata, trem, "\\%03u", c); - memcpy(tdata, buf, 4); tdata += 4; trem -= 4; ndata++; @@ -1942,7 +1941,7 @@ dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot, } else { if (trem < 3) return (ISC_R_NOSPACE); - sprintf(tdata, "%%%02X", c); + snprintf(tdata, trem, "%%%02X", c); tdata += 3; trem -= 3; ndata++; diff --git a/usr.sbin/bind/lib/dns/rdata.c b/usr.sbin/bind/lib/dns/rdata.c index 0160e04e94d..cb696841f85 100644 --- a/usr.sbin/bind/lib/dns/rdata.c +++ b/usr.sbin/bind/lib/dns/rdata.c @@ -1369,7 +1369,7 @@ txt_totext(isc_region_t *source, isc_buffer_t *target) { if (*sp < 0x20 || *sp >= 0x7f) { if (tl < 4) return (ISC_R_NOSPACE); - snprintf(tp, 5, "\\%03u", *sp++); + snprintf(tp, tl, "\\%03u", *sp++); tp += 4; tl -= 4; continue; diff --git a/usr.sbin/bind/lib/dns/sec/dst/dst_api.c b/usr.sbin/bind/lib/dns/sec/dst/dst_api.c index 260181a7582..637414c3e07 100644 --- a/usr.sbin/bind/lib/dns/sec/dst/dst_api.c +++ b/usr.sbin/bind/lib/dns/sec/dst/dst_api.c @@ -1000,7 +1000,9 @@ buildfilename(dns_name_t *name, dns_keytag_t id, len = 1 + 3 + 1 + 5 + strlen(suffix) + 1; if (isc_buffer_availablelength(out) < len) return (ISC_R_NOSPACE); - sprintf((char *) isc_buffer_used(out), "+%03d+%05d%s", alg, id, suffix); + snprintf((char *) isc_buffer_used(out), + isc_buffer_availablelength(out), + "+%03d+%05d%s", alg, id, suffix); isc_buffer_add(out, len); return (ISC_R_SUCCESS); } diff --git a/usr.sbin/bind/lib/lwres/gethost.c b/usr.sbin/bind/lib/lwres/gethost.c index a61d0ef35ac..aa7cefea3df 100644 --- a/usr.sbin/bind/lib/lwres/gethost.c +++ b/usr.sbin/bind/lib/lwres/gethost.c @@ -198,8 +198,13 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { /* * Copy official name. */ - n = strlen(he->h_name) + 1; - strcpy(cp, he->h_name); + n = (buf + buflen) - cp; + { + int r; + r = strlcpy(cp, he->h_name, n); + if ( r < n ) + n = r; + } hptr->h_name = cp; cp += n; @@ -208,8 +213,14 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { */ hptr->h_aliases = ptr; for (i = 0; he->h_aliases[i]; i++) { - n = strlen(he->h_aliases[i]) + 1; - strcpy(cp, he->h_aliases[i]); + n = (buf + buflen) - cp; + { + int r; + r = strlcpy(cp, he->h_aliases[i], n); + if ( r < n ) + n = r; + } + hptr->h_aliases[i] = cp; cp += n; } diff --git a/usr.sbin/bind/lib/lwres/lwinetntop.c b/usr.sbin/bind/lib/lwres/lwinetntop.c index 071eb83efe6..d6ab0ab20b6 100644 --- a/usr.sbin/bind/lib/lwres/lwinetntop.c +++ b/usr.sbin/bind/lib/lwres/lwinetntop.c @@ -86,7 +86,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size) { size_t len; len = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); - if (len >= size) { + if (len >= sizeof(tmp)) { errno = ENOSPC; return (NULL); } |