From 172d0c401e058854ca2ac41bba4c09b87dbcf814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 9 May 2018 08:09:54 +0200 Subject: [PATCH] Address GCC 8 -Wformat-truncation warnings --- bin/named/server.c | 3 ++- lib/dns/dnssec.c | 8 ++++++-- lib/dns/rdata/generic/loc_29.c | 2 +- lib/isc/unix/file.c | 2 +- lib/isc/win32/file.c | 2 +- lib/ns/notify.c | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 93611f2949..9fe8264943 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -13836,7 +13836,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, const char *type, *file; char zonename[DNS_NAME_FORMATSIZE]; isc_uint32_t serial, signed_serial, nodes; - char serbuf[16], sserbuf[16], nodebuf[16], resignbuf[512]; + char serbuf[16], sserbuf[16], nodebuf[16]; + char resignbuf[DNS_NAME_FORMATSIZE + DNS_RDATATYPE_FORMATSIZE + 2]; char lbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; char xbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; char rbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 6628177f63..91a7ceb8ce 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -776,7 +776,9 @@ dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, } if (result != ISC_R_SUCCESS) { - char filename[ISC_DIR_NAMEMAX]; + char filename[DNS_NAME_FORMATSIZE + + DNS_SECALG_FORMATSIZE + + sizeof("key file for //65535")]; isc_result_t result2; isc_buffer_t buf; @@ -1668,7 +1670,9 @@ dns_dnssec_keylistfromrdataset(const dns_name_t *origin, } if (result != ISC_R_SUCCESS) { - char filename[ISC_DIR_NAMEMAX]; + char filename[DNS_NAME_FORMATSIZE + + DNS_SECALG_FORMATSIZE + + sizeof("key file for //65535")]; isc_result_t result2; isc_buffer_t buf; diff --git a/lib/dns/rdata/generic/loc_29.c b/lib/dns/rdata/generic/loc_29.c index e0b72514ab..fb5edcd2b4 100644 --- a/lib/dns/rdata/generic/loc_29.c +++ b/lib/dns/rdata/generic/loc_29.c @@ -459,7 +459,7 @@ totext_loc(ARGS_TOTEXT) { isc_boolean_t below; isc_region_t sr; char buf[sizeof("89 59 59.999 N 179 59 59.999 E " - "42849672.95m 90000000m 90000000m 90000000m")]; + "-42849672.95m 90000000m 90000000m 90000000m")]; char sbuf[sizeof("90000000m")]; char hbuf[sizeof("90000000m")]; char vbuf[sizeof("90000000m")]; diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 0f305b57a3..efa0f2f933 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -714,7 +714,7 @@ isc_result_t isc_file_sanitize(const char *dir, const char *base, const char *ext, char *path, size_t length) { - char buf[PATH_MAX], hash[PATH_MAX]; + char buf[PATH_MAX], hash[ISC_SHA256_DIGESTSTRINGLENGTH]; size_t l = 0; REQUIRE(base != NULL); diff --git a/lib/isc/win32/file.c b/lib/isc/win32/file.c index cdd9b11c1b..6c945636c0 100644 --- a/lib/isc/win32/file.c +++ b/lib/isc/win32/file.c @@ -785,7 +785,7 @@ isc_result_t isc_file_sanitize(const char *dir, const char *base, const char *ext, char *path, size_t length) { - char buf[PATH_MAX], hash[PATH_MAX]; + char buf[PATH_MAX], hash[ISC_SHA256_DIGESTSTRINGLENGTH]; size_t l = 0; REQUIRE(base != NULL); diff --git a/lib/ns/notify.c b/lib/ns/notify.c index f507b0ecad..c3da3bf3db 100644 --- a/lib/ns/notify.c +++ b/lib/ns/notify.c @@ -73,7 +73,7 @@ ns_notify_start(ns_client_t *client) { dns_rdataset_t *zone_rdataset; dns_zone_t *zone = NULL; char namebuf[DNS_NAME_FORMATSIZE]; - char tsigbuf[DNS_NAME_FORMATSIZE + sizeof(": TSIG ''")]; + char tsigbuf[DNS_NAME_FORMATSIZE * 2 + sizeof(": TSIG '' ()")]; dns_tsigkey_t *tsigkey; /*