From: Michał Kępień Date: Tue, 30 Jul 2019 19:08:40 +0000 (+0200) Subject: Tweak buffer sizes to prevent compilation warnings X-Git-Tag: v9.15.3~26^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3384455659a7d64d7dae86038b317c7a835aafca;p=thirdparty%2Fbind9.git Tweak buffer sizes to prevent compilation warnings For some libc implementations, BUFSIZ is small enough (e.g. 1024 for musl libc) to trigger compilation warnings about insufficient size of certain buffers. Since the relevant buffers are used for printing DNS names, increase their size to '(n + 1) * DNS_NAME_FORMATSIZE', where 'n' is the number of DNS names which are printed to a given buffer. This results in somewhat arbitrary, albeit nicely-aligned and large enough buffer sizes. --- diff --git a/lib/ns/query.c b/lib/ns/query.c index 310e8ccd7f9..ce5d6374a16 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -5090,7 +5090,7 @@ qctx_destroy(query_ctx_t *qctx) { static void query_trace(query_ctx_t *qctx) { #ifdef WANT_QUERYTRACE - char mbuf[BUFSIZ]; + char mbuf[2 * DNS_NAME_FORMATSIZE]; char qbuf[DNS_NAME_FORMATSIZE]; if (qctx->client->query.origqname != NULL) @@ -5882,7 +5882,7 @@ query_resume(query_ctx_t *qctx) { dns_name_t *tname; isc_buffer_t b; #ifdef WANT_QUERYTRACE - char mbuf[BUFSIZ]; + char mbuf[4 * DNS_NAME_FORMATSIZE]; char qbuf[DNS_NAME_FORMATSIZE]; char tbuf[DNS_RDATATYPE_FORMATSIZE]; #endif