]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tweak buffer sizes to prevent compilation warnings
authorMichał Kępień <michal@isc.org>
Tue, 30 Jul 2019 19:08:40 +0000 (21:08 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 30 Jul 2019 19:25:18 +0000 (21:25 +0200)
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.

lib/ns/query.c

index 310e8ccd7f933e6e1cff592661aa7539f50b8886..ce5d6374a163897f9c361a8e67e017be5d1a7fba 100644 (file)
@@ -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