]> 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:46 +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.

(cherry picked from commit 3384455659a7d64d7dae86038b317c7a835aafca)

lib/ns/query.c

index de1a1163d53f32c1d9f94084a68d45749b1cee09..c46864c48bccb3e80ba691ed25c7bebc68fee123 100644 (file)
@@ -5093,7 +5093,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)
@@ -5872,7 +5872,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