Commit graph

29631 commits

Author SHA1 Message Date
Mark Andrews
2894de2ab3 Merge branch 'marka-cppcheck-fixes-v9_12-and-v9_14' into 'v9_14'
Address cppcheck reports (v9_11/v9_14)

See merge request isc-projects/bind9!2342
2019-10-03 23:36:19 -04:00
Mark Andrews
fcebc4f15b Address cppcheck reports 2019-10-04 13:06:00 +10:00
Mark Andrews
b396c9dfde Merge branch 'marka-silence-clang-v9_14' into 'v9_14'
silence clang warning by using local variable.

See merge request isc-projects/bind9!2441
2019-10-03 21:58:45 -04:00
Mark Andrews
b997237f49 silence clang warning by using local variable.
'isc_commandline_index' is a global variable so it can theoretically
change result between if expressions.  Save 'argv[isc_commandline_index]'
to local variable 'arg1' and use 'arg1 == NULL' in if expressions
instead of 'argc < isc_commandline_index + 1'.  This allows clang
to correctly determine what code is reachable.

(cherry picked from commit 1b27ab8642)
2019-10-04 11:36:19 +10:00
Ondřej Surý
418b340a8f Merge branch 'ondrej/fix-docs-autoreconf-v9_14' into 'v9_14'
Fix docs -> autoreconf dependencies in the .gitlab-ci.yml (v9_14)

See merge request isc-projects/bind9!2439
2019-10-03 10:08:05 -04:00
Ondřej Surý
3b339eb43f Fix the triggering rule for autoreconf job (take 2) 2019-10-03 15:34:09 +02:00
Ondřej Surý
cc4c5482ef Fix docs -> autoreconf dependencies in the .gitlab-ci.yml 2019-10-03 15:34:06 +02:00
Ondřej Surý
c70c4be5c4 Merge branch 'ondrej/enable-cppcheck-v9_14' into 'v9_14'
Enable Cppcheck for v9_14 branch

See merge request isc-projects/bind9!2432
2019-10-03 08:20:18 -04:00
Ondřej Surý
2ae68cd120 Use util/suppressions.txt for Cppcheck suppressions list 2019-10-03 14:02:08 +02: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ý
67978007a2 bin/named/zoneconf.c: Reset dns_name_t *tsig on every view iteration
(cherry picked from commit 43925b2a8b)
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
Ondřej Surý
3a10558787 bin/named/server.c: Fix couple of DbC conditions reported by Cppcheck
(cherry picked from commit 476277a6e6)
2019-10-03 09:50:25 +02:00
Ondřej Surý
dfe1bb5388 bin/dig/dighost.c: Fix REQUIRE(!= NULL) condition after the variable has been dereferenced
(cherry picked from commit 9366ca769f)
2019-10-03 09:50:25 +02:00
Ondřej Surý
a2c7b2f619 bin/delv/delv.c: Fix invalid logic operation in REQUIRE() condition
(cherry picked from commit 9ab16d10d4)
2019-10-03 09:50:25 +02:00
Ondřej Surý
b9cb767cbf Add Cppcheck job to the CI
This MR changes the default Debian sid build to wrap make with bear
that creates compilation database and use the compilation database
to run Cppcheck on the source files systematically.

The job is currently set to be allowed to fail as it will take some
time to fix all the Cppcheck detected issues.

(cherry picked from commit f55dc51f42)
2019-10-03 09:50:25 +02:00
Evan Hunt
7434f80008 Merge branch '1191-qmin-fetch-failure-v9_14' into 'v9_14'
SERVFAIL if a prior qmin fetch has not been canceled when a new one starts

See merge request isc-projects/bind9!2426
2019-10-02 00:45:55 -04:00
Evan Hunt
31636d05c4 CHANGES
(cherry picked from commit 1d741c5c0f)
2019-10-01 21:20:38 -07: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
Ondřej Surý
dd4c4d155c Merge branch '846-dig-idn-alabel-fallback-v9_14' into 'v9_14'
Resolve "dig cannot display ACE query if locale is not unicode"

See merge request isc-projects/bind9!2413
2019-09-30 06:51:14 -04:00
Ondřej Surý
b5ca157e2a Add CHANGES for GL #846
(cherry picked from commit dccec984c0)
2019-09-30 11:53:28 +02:00
Ondřej Surý
f5d443aa56 Test of valid A-label in locale that cannot display it only with non-broken idn2
The libidn2 library on Ubuntu Bionic is broken and idn2_to_unicode_8zlz() does't
fail when it should.  This commit ensures that we don't run the system test for
valid A-label in locale that cannot display with the buggy libidn2 as it would
break the tests.

(cherry picked from commit c42e3583f9)
2019-09-30 11:53:28 +02:00