Commit graph

11896 commits

Author SHA1 Message Date
Mark Andrews
fcebc4f15b Address cppcheck reports 2019-10-04 13:06:00 +10:00
Ondřej Surý
36b0c5a517 lib/isc/tests/md_test.c: Silence sizeofFunctionCall Cppcheck 2019-10-03 12:44:02 +02:00
Ondřej Surý
e8f64e99f3 lib/isc/tests/hmac_test.c: Silence sizeofFunctionCall Cppcheck 2019-10-03 12:44:02 +02:00
Ondřej Surý
fedfd48a08 lib/dns/zone.c: Fix invalid order of DbC checks that could cause dereference before NULL check 2019-10-03 10:16:03 +02:00
Ondřej Surý
6a82289e35 lib/dns/sdlz.c: Use the referenced variable in the DbC check 2019-10-03 10:15:35 +02:00
Ondřej Surý
9ffcc8f165 lib/dns/sdb.c: Fix invalid order of DbC checks that could cause dereference before NULL check 2019-10-03 10:14:43 +02:00
Ondřej Surý
9f75d17e95 Remove randomly scattered additional style check suppressions that caused unmatchedSuppression
(cherry picked from commit a0d3614a60)
2019-10-03 09:50:27 +02:00
Ondřej Surý
beb05c3d78 lib/ns/query.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit d1f035bbba)
2019-10-03 09:50:27 +02:00
Ondřej Surý
82d3faa274 lib/ns/interfacemgr.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit 033f3eb580)
2019-10-03 09:50:27 +02:00
Ondřej Surý
c12ff394f1 lib/ns/client.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit b4a42a286f)
2019-10-03 09:50:27 +02:00
Ondřej Surý
929fc207c7 lib/isccfg/parser.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit f855f09a55)
2019-10-03 09:50:27 +02:00
Ondřej Surý
22d5735a0e lib/isccfg/aclconf.c: Suppress nullPointerRedundantCheck false positive
(cherry picked from commit 09232213d7)
2019-10-03 09:50:27 +02:00
Ondřej Surý
be4aafeac7 lib/isc/unix/socket.c: Suppress preprocessorErrorDirective error from Cppcheck
(cherry picked from commit 026cf2ff4f)
2019-10-03 09:50:27 +02:00
Ondřej Surý
d6de4edc41 lib/isc/task.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit c662969da1)
2019-10-03 09:50:27 +02:00
Ondřej Surý
4acf396f83 lib/isc/pkc11.c: Fix possible NULL pointer dereference in push_attribute()
(cherry picked from commit e8948fd9b4)
2019-10-03 09:50:27 +02:00
Ondřej Surý
ac1127b2ad lib/isc/buffer.c: Fix invalid order of DbC checks that could cause dereference before NULL check
(cherry picked from commit e9f30fc211)
2019-10-03 09:50:26 +02:00
Ondřej Surý
8b32d11206 lib/dns/tsig.c: Suppress Cppcheck false positive error uninitStructMember
(cherry picked from commit 8f2ad12d0a)
2019-10-03 09:50:26 +02:00
Ondřej Surý
8db221d97a lib/dns/tests/rbt_serialize_test.c: Fix dereference before DbC check
(cherry picked from commit 14c174d921)
2019-10-03 09:50:26 +02:00
Ondřej Surý
4ef534aa90 Instead of declaring unused va_list, just don't declare it at all
(cherry picked from commit 269d507ccc)
2019-10-03 09:50:26 +02:00
Ondřej Surý
c3c515b56b lib/dns/rdatalist.c: Fix dereference before DbC check
(cherry picked from commit 5fc7e98d29)
2019-10-03 09:50:26 +02:00
Ondřej Surý
e442d1bbd2 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 09:50:26 +02:00
Ondřej Surý
2f5a7e84d9 lib/dns/rdata.c: Silence false positive nullPointerRedundantCheck warning from Cppcheck
(cherry picked from commit e68333aa67)
2019-10-03 09:50:26 +02:00
Ondřej Surý
7379248d9c lib/dns/rbtdb.c: Add DbC check to safely dereference rbtdb in rbt_datafixer()
(cherry picked from commit d508ce4036)
2019-10-03 09:50:26 +02:00
Ondřej Surý
4a129256e4 lib/dns/rbt.c: Suppress nullPointerRedundantCheck warnings from Cppcheck
(cherry picked from commit 8be5c3fcfc)
2019-10-03 09:50:26 +02:00
Ondřej Surý
e5474241e9 lib/dns/name.c: Fix dereference before DbC check reported by Cppcheck
(cherry picked from commit 0f5860aad3)
2019-10-03 09:50:26 +02:00
Ondřej Surý
df21cac6a8 lib/dns/gssapi_link.c: Fix %d -> %u formatting when printing unsigned integers
(cherry picked from commit cea871464f)
2019-10-03 09:50:26 +02:00
Ondřej Surý
e3ccbb7dc0 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 09:50:26 +02:00
Ondřej Surý
a3abf117ad lib/dns/ecdb.c: Fix couple of DbC conditions reported by Cppcheck
(cherry picked from commit 91cc6b9eb9)
2019-10-03 09:50:25 +02:00
Ondřej Surý
a8a0c78927 Fix the constification of the dns_name_t * result variable for dns_tsig_identity()
(cherry picked from commit fa7475b77a)
2019-10-03 09:50:25 +02:00
Ondřej Surý
adb4e80f58 Change dns_tsigkey_identity from macro to a function and const argument and result
(cherry picked from commit 2e304b0b7f)
2019-10-03 09:50:25 +02:00
Ondřej Surý
2163567cb8 Constify dns_name_t *signer argument to dns_acl_allowed()
(cherry picked from commit 4d2697b31c)
2019-10-03 09:50:25 +02:00
Evan Hunt
b632142526 SERVFAIL if a prior qmin fetch has not been canceled when a new one starts
(cherry picked from commit 488cb4da10)
2019-10-01 21:20:20 -07:00
Mark Andrews
76a15b6fe8 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:31 +10:00
Michał Kępień
78a3cacf8d 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 09:16:02 +02:00
Ondřej Surý
903fab5f6c Silence false positive warning from Clang 10 in random_test.c
(cherry picked from commit 9ff02c8170)
2019-09-26 15:24:56 +02:00
Ondřej Surý
9d400c7d89 Fix the wrong function for the atomic_fetch_add_explicit64 shim on non-WIN64 build 2019-09-26 13:01:26 +02:00
Mark Andrews
bf63ff09c1 Queue nsec3param setting until receive_secure_serial has completed.
(cherry picked from commit 456888c00f)
2019-09-24 11:37:37 +10:00
Mark Andrews
31a905775c reinstate error handler
(cherry picked from commit 7fb0a0db53)
2019-09-13 14:29:54 +10:00
Mark Andrews
946f08db99 declare alloc_failure
(cherry picked from commit 0d23bc5b55)
2019-09-13 14:26:36 +10:00
Mark Andrews
fd395947ad declare result
(cherry picked from commit 9ee27573af)
2019-09-13 14:26:36 +10:00
Mark Andrews
57824120e4 address or suppress cppcheck warnings
(cherry picked from commit b59fe46e76)
2019-09-12 19:27:28 +10:00
Tinderbox User
2a2d8d00aa prep for 9.14.6 2019-09-09 13:34:28 +00:00
Mark Andrews
7b26e2d819 use rpzs->updater as rpz->rpzs is NULL
(cherry picked from commit 3e82a2ea9a)
2019-09-05 07:29:05 +10:00
Mark Andrews
d72f73af48 implement maxudp under windows
(cherry picked from commit 2f558854b7)
2019-09-04 10:50:00 +10:00
Ondřej Surý
77a68cbd4c 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:21:40 +02:00
Evan Hunt
2a58b03336 when a response-policy zone expires, unload its polices from RPZ summary
(cherry picked from commit 7ba6d592ec)
2019-08-30 13:08:48 -07:00
Evan Hunt
326ec91c8b 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:08:16 -07:00
Ondřej Surý
d17168b102 Remove the tkey_test.c from the BIND 9.14 branch, it's no-op here anyway. 2019-08-29 15:37:03 +02:00
Ondřej Surý
1c084c35f0 Fix uninitialized variable warning in restore_nsec3param() 2019-08-29 15:14:24 +02:00
Mark Andrews
768fb45660 check that open() succeeded
(cherry picked from commit 510306c654)
2019-08-29 10:26:00 +10:00