summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bind/lib/dns/rdata/generic/soa_6.c7
-rw-r--r--usr.sbin/bind/lib/dns/ttl.c10
-rw-r--r--usr.sbin/bind/lib/lwres/lwinetntop.c6
3 files changed, 13 insertions, 10 deletions
diff --git a/usr.sbin/bind/lib/dns/rdata/generic/soa_6.c b/usr.sbin/bind/lib/dns/rdata/generic/soa_6.c
index ecbd87e7923..1d62c9f5b6b 100644
--- a/usr.sbin/bind/lib/dns/rdata/generic/soa_6.c
+++ b/usr.sbin/bind/lib/dns/rdata/generic/soa_6.c
@@ -130,14 +130,15 @@ totext_soa(ARGS_TOTEXT) {
for (i = 0; i < 5; i++) {
char buf[sizeof("2147483647")];
unsigned long num;
- unsigned int numlen;
+ int numlen;
num = uint32_fromregion(&dregion);
isc_region_consume(&dregion, 4);
numlen = snprintf(buf, sizeof(buf), "%lu", num);
- INSIST(numlen > 0 && numlen < sizeof("2147483647"));
+ INSIST(numlen != -1 && (size_t)numlen < sizeof(buf));
RETERR(str_totext(buf, target));
if (multiline && comment) {
- RETERR(str_totext(" ; " + numlen, target));
+ RETERR(str_totext(" ; " +
+ (unsigned int)numlen, target));
RETERR(str_totext(soa_fieldnames[i], target));
/* Print times in week/day/hour/minute/second form */
if (i >= 1) {
diff --git a/usr.sbin/bind/lib/dns/ttl.c b/usr.sbin/bind/lib/dns/ttl.c
index 849f10f2ad1..003703aad21 100644
--- a/usr.sbin/bind/lib/dns/ttl.c
+++ b/usr.sbin/bind/lib/dns/ttl.c
@@ -51,7 +51,7 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
isc_boolean_t space, isc_buffer_t *target)
{
char tmp[60];
- size_t len;
+ int len;
isc_region_t region;
if (verbose)
@@ -62,12 +62,12 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
else
len = snprintf(tmp, sizeof(tmp), "%u%c", t, s[0]);
- INSIST(len + 1 <= sizeof(tmp));
+ INSIST(len != -1 && (size_t)len + 1 <= sizeof(tmp));
isc_buffer_availableregion(target, &region);
- if (len > region.length)
+ if ((size_t)len > region.length)
return (ISC_R_NOSPACE);
- memcpy(region.base, tmp, len);
- isc_buffer_add(target, len);
+ memcpy(region.base, tmp, (size_t)len);
+ isc_buffer_add(target, (size_t)len);
return (ISC_R_SUCCESS);
}
diff --git a/usr.sbin/bind/lib/lwres/lwinetntop.c b/usr.sbin/bind/lib/lwres/lwinetntop.c
index 1d02defdf9a..311c5837ed9 100644
--- a/usr.sbin/bind/lib/lwres/lwinetntop.c
+++ b/usr.sbin/bind/lib/lwres/lwinetntop.c
@@ -84,10 +84,12 @@ static const char *
inet_ntop4(const unsigned char *src, char *dst, size_t size) {
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof("255.255.255.255")];
- size_t len;
+ int len;
len = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
- if (len >= size) {
+ if (len == -1)
+ return (NULL);
+ if ((size_t)len >= size) {
errno = ENOSPC;
return (NULL);
}