]> 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 20:22:28 +0000 (22:22 +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)

bin/named/query.c

index b6535cb75f2c1cdc52ebd926153f9e621817eebf..86417c7ebdbe90453ef38f36d26d9da3d755adff 100644 (file)
@@ -6789,7 +6789,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
        bool failcache;
        uint32_t flags;
 #ifdef WANT_QUERYTRACE
-       char mbuf[BUFSIZ];
+       char mbuf[4 * DNS_NAME_FORMATSIZE];
        char qbuf[DNS_NAME_FORMATSIZE];
        char tbuf[DNS_RDATATYPE_FORMATSIZE];
 #endif