Commit Graph

11157 Commits

Author SHA1 Message Date
Ondřej Surý
49d017aa75 lib/dns/tests/rbt_serialize_test.c: Fix dereference before DbC check
(cherry picked from commit 14c174d921)
2019-10-03 14:21:46 +02:00
Ondřej Surý
b20df811fb Instead of declaring unused va_list, just don't declare it at all
(cherry picked from commit 269d507ccc)
2019-10-03 14:21:46 +02:00
Ondřej Surý
d76c92bba7 lib/dns/rdatalist.c: Fix dereference before DbC check
(cherry picked from commit 5fc7e98d29)
2019-10-03 14:21:46 +02:00
Ondřej Surý
8a01f18958 lib/dns/rdata/*/*.c: Silence false positive nullPointerRedundantCheck warning from Cppcheck
Cppcheck gets confused by:

void bar(void *arg) {
    foo *data = arg;
    REQUIRE(source != NULL);
    REQUIRE(data->member != NULL);
}

and for consistency the DbC check needs to be changed to

void bar(void *arg) {
    foo *data = arg;
    REQUIRE(data != NULL);
    REQUIRE(data->member != NULL);
}

(cherry picked from commit 66af8713d8)
2019-10-03 14:21:46 +02:00
Ondřej Surý
56a2cba642 lib/dns/rdata.c: Silence false positive nullPointerRedundantCheck warning from Cppcheck
(cherry picked from commit e68333aa67)
2019-10-03 14:21:46 +02:00
Ondřej Surý
c1df74f9c9 lib/dns/rbtdb.c: Add DbC check to safely dereference rbtdb in rbt_datafixer()
(cherry picked from commit d508ce4036)
2019-10-03 14:21:46 +02:00
Ondřej Surý
d04cc31c6e lib/dns/rbt.c: Suppress nullPointerRedundantCheck warnings from Cppcheck
(cherry picked from commit 8be5c3fcfc)
2019-10-03 14:21:46 +02:00
Ondřej Surý
f8200d8802 lib/dns/name.c: Fix dereference before DbC check reported by Cppcheck
(cherry picked from commit 0f5860aad3)
2019-10-03 14:21:46 +02:00
Ondřej Surý
68ae992b71 lib/dns/gssapi_link.c: Fix %d -> %u formatting when printing unsigned integers
(cherry picked from commit cea871464f)
2019-10-03 14:21:46 +02:00
Ondřej Surý
601380c4ed Fix passing NULL after the last typed argument to a variadic function leads to undefined behaviour.
From Cppcheck:

Passing NULL after the last typed argument to a variadic function leads to
undefined behaviour.  The C99 standard, in section 7.15.1.1, states that if the
type used by va_arg() is not compatible with the type of the actual next
argument (as promoted according to the default argument promotions), the
behavior is undefined.  The value of the NULL macro is an implementation-defined
null pointer constant (7.17), which can be any integer constant expression with
the value 0, or such an expression casted to (void*) (6.3.2.3). This includes
values like 0, 0L, or even 0LL.In practice on common architectures, this will
cause real crashes if sizeof(int) != sizeof(void*), and NULL is defined to 0 or
any other null pointer constant that promotes to int.  To reproduce you might be
able to use this little code example on 64bit platforms. If the output includes
"ERROR", the sentinel had only 4 out of 8 bytes initialized to zero and was not
detected as the final argument to stop argument processing via
va_arg(). Changing the 0 to (void*)0 or 0L will make the "ERROR" output go away.

void f(char *s, ...) {
    va_list ap;
    va_start(ap,s);
    for (;;) {
        char *p = va_arg(ap,char*);
        printf("%018p, %s\n", p, (long)p & 255 ? p : "");
        if(!p) break;
    }
    va_end(ap);
}

void g() {
    char *s2 = "x";
    char *s3 = "ERROR";

    // changing 0 to 0L for the 7th argument (which is intended to act as
    // sentinel) makes the error go away on x86_64
    f("first", s2, s2, s2, s2, s2, 0, s3, (char*)0);
}

void h() {
    int i;
    volatile unsigned char a[1000];
    for (i = 0; i<sizeof(a); i++)
        a[i] = -1;
}

int main() {
    h();
    g();
    return 0;
}

(cherry picked from commit d8879af877)
2019-10-03 14:21:46 +02:00
Ondřej Surý
034df34d92 lib/dns/ecdb.c: Fix couple of DbC conditions reported by Cppcheck
(cherry picked from commit 91cc6b9eb9)
2019-10-03 14:21:46 +02:00
Ondřej Surý
8dea1118c7 Fix the constification of the dns_name_t * result variable for dns_tsig_identity()
(cherry picked from commit fa7475b77a)
2019-10-03 14:21:46 +02:00
Ondřej Surý
d16e4994e3 Change dns_tsigkey_identity from macro to a function and const argument and result
(cherry picked from commit 2e304b0b7f)
2019-10-03 09:55:30 +02:00
Mark Andrews
9f144a5281 suppress cppcheck warning: literalWithCharPtrCompare 2019-10-02 09:25:00 +10:00
Mark Andrews
bef21ed45d suppress cppcheck warning: constArgument 2019-10-02 09:25:00 +10:00
Mark Andrews
5dc016f67e suppress cppcheck warning: unreadVariable on union 2019-10-02 09:25:00 +10:00
Mark Andrews
07e5969fe0 suppress cppcheck warning: leakNoVarFunctionCall 2019-10-02 09:25:00 +10:00
Mark Andrews
8020fc9c1c suppress cppcheck error: memleak he.h_name 2019-10-02 09:25:00 +10:00
Mark Andrews
0936009af6 fix cppcheck warning: unusedVariable by reducing the scope of 'result' 2019-10-02 09:25:00 +10:00
Mark Andrews
1f3f8263a8 fix cppcheck warning: shadowedVariable by reducing scope of 'p' 2019-10-02 09:25:00 +10:00
Mark Andrews
c46caa92e8 fix cppcheck warning: unassignedVariable 2019-10-02 09:25:00 +10:00
Mark Andrews
73c1a7e03b fix cppcheck warnings: unreadVariable 2019-10-02 09:25:00 +10:00
Mark Andrews
875776e5a6 fix cppcheck warnings: adjust format strings to match arguments. 2019-10-02 09:25:00 +10:00
Mark Andrews
d6a14935b7 fix cppcheck warnings: duplicateCondition 2019-10-01 21:28:30 +10:00
Mark Andrews
76745b8cb5 Address cut-and-paste error where list name was not changed in one instance for change 5292.
(cherry picked from commit 9cd308ac5e)
2019-09-29 10:52:47 +10:00
Michał Kępień
61e4c9198a Make VS solution upgrading unnecessary
Until now, the build process for BIND on Windows involved upgrading the
solution file to the version of Visual Studio used on the build host.
Unfortunately, the executable used for that (devenv.exe) is not part of
Visual Studio Build Tools and thus there is no clean way to make that
executable part of a Windows Server container.

Luckily, the solution upgrade process boils down to just adding XML tags
to Visual Studio project files and modifying certain XML attributes - in
files which we pregenerate anyway using win32utils/Configure.  Thus,
extend win32utils/Configure with three new command line parameters that
enable it to mimic what "devenv.exe bind9.sln /upgrade" does.  This
makes the devenv.exe build step redundant and thus facilitates building
BIND in Windows Server containers.

(cherry picked from commit 0476e8f1ac)
2019-09-27 12:13:39 +02:00
Ondřej Surý
8b86335504 Fix unprotected access to rbtnode in lib/dns/rbtdb.c:add32()
(cherry picked from commit e307273307)
2019-09-25 13:36:56 +02:00
Mark Andrews
7d89e40ea0 Queue nsec3param setting until receive_secure_serial has completed.
(cherry picked from commit 456888c00f)
2019-09-24 11:38:26 +10:00
Mark Andrews
7fb0a0db53 reinstate error handler 2019-09-13 14:17:32 +10:00
Mark Andrews
0d23bc5b55 declare alloc_failure 2019-09-13 13:57:41 +10:00
Mark Andrews
9ee27573af declare result 2019-09-13 13:48:20 +10:00
Mark Andrews
ff700b2259 address or suppress cppcheck warnings
(cherry picked from commit b59fe46e76)
2019-09-12 19:31:56 +10:00
Tinderbox User
1860bab56b prep for 9.11.11 2019-09-09 14:22:44 +00:00
Mark Andrews
47722eacbf remove accidentally back ported code 2019-09-09 16:27:22 +10:00
Mark Andrews
5c23d41ba3 check that 'valuep' is not NULL befor assigning to '*valuep' 2019-09-06 11:50:30 +10:00
Mark Andrews
34eba51728 fix backport of maxudp for windows 2019-09-04 16:09:07 +10:00
Mark Andrews
b44ad05d20 implement maxudp under windows
(cherry picked from commit 2f558854b7)
2019-09-04 11:09:31 +10:00
Ondřej Surý
3c85a1f104 Fix alignment issues in the native implementation of isc_siphash24()
The native implementation's conversion from the uint8_t buffers to uint64_t now
follows the reference implementation that doesn't require aligned buffers.
2019-09-02 13:22:40 +02:00
Evan Hunt
564a62bc2f use an rbtnodechain to walk up labels
when looking for a possible wildcard match in the RPZ summary database,
use an rbtnodechain to walk up label by label, rather than using the
node's parent pointer.

(cherry picked from commit 6e9be9a952)
2019-08-29 20:05:22 -07:00
Ondřej Surý
397249f0b3 Fix uninitialized variable warning in restore_nsec3param()
(cherry picked from commit 1c084c35f0)
2019-08-29 16:04:05 +02:00
Mark Andrews
b94f0db15b check that open() succeeded
(cherry picked from commit 510306c654)
2019-08-29 10:26:22 +10:00
Mark Andrews
b67c6fe8bd Add support for displaying EDNS option LLQ.
(cherry picked from commit d98f446d3f)
2019-08-28 17:48:24 +10:00
Mark Andrews
6aee585e94 add dns_zone_cdscheck to integrity checks
(cherry picked from commit cd40c9fe61)
2019-08-28 16:27:09 +10:00
Mark Andrews
70a85ab614 implement getoriginnode for sdb
(cherry picked from commit 2ebc4776ca)
2019-08-28 16:26:24 +10:00
Tinderbox User
eb55184bda prep 9.11.10 2019-08-13 09:34:56 +00:00
Michał Kępień
3806811c04 Fix faulty backport which broke the Windows build
Commit 91307842b8 inadvertently mangled
the XML structure inside lib/isc/win32/libisc.vcxproj.filters.in, thus
breaking the Windows build.  Add the missing XML tags to make Windows
builds work again.
2019-08-08 20:45:30 +02:00
Ondřej Surý
e80c4c3431 Have the dns_client hold a .references until all external references are removed
so that cleanup can all be done in dns_client_destroy().
2019-08-07 11:35:06 +02:00
Mark Andrews
be8af3afb7 Have the view hold a weakref until all external references are removed
so that cleanup can all be done in dns_view_weakattach().
2019-08-06 17:18:48 +02:00
Ondřej Surý
6353032a8a lib/isc/app_api.c: Protect the global is_running bool variable with a mutex 2019-08-06 15:03:35 +02:00
Ondřej Surý
a7c9a52c89 lib/dns/resolver.c: Convert (dns_view_t *)->weakrefs to isc_refcount_t
There's a deadlock in BIND 9 code where (dns_view_t){ .lock } and
(dns_resolver_t){ .buckets[i].lock } gets locked in different order.  When
view->weakrefs gets converted to a reference counting we can reduce the locking
in dns_view_weakdetach only to cases where it's the last instance of the
dns_view_t object.
2019-08-06 15:03:35 +02:00