Commit Graph

27880 Commits

Author SHA1 Message Date
Ondřej Surý
8f23f39fee lib/isc/unix/socket.c: Suppress preprocessorErrorDirective error from Cppcheck
(cherry picked from commit 026cf2ff4f)
2019-10-03 14:21:46 +02:00
Ondřej Surý
0e8e4c9174 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 14:21:46 +02:00
Ondřej Surý
91999a143d lib/isc/pkc11.c: Fix possible NULL pointer dereference in push_attribute()
(cherry picked from commit e8948fd9b4)
2019-10-03 14:21:46 +02:00
Ondřej Surý
7accb1029f 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 14:21:46 +02:00
Ondřej Surý
1506ad6e76 lib/dns/tsig.c: Suppress Cppcheck false positive error uninitStructMember
(cherry picked from commit 8f2ad12d0a)
2019-10-03 14:21:46 +02:00
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ý
aa5889959d bin/named/zoneconf.c: Reset dns_name_t *tsig on every view iteration
(cherry picked from commit 43925b2a8b)
2019-10-03 10:01:45 +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
Ondřej Surý
7f8bd90ad4 bin/named/server.c: Fix couple of DbC conditions reported by Cppcheck
(cherry picked from commit 476277a6e6)
2019-10-03 09:54:01 +02:00
Ondřej Surý
fe9194880e bin/dig/dighost.c: Fix REQUIRE(!= NULL) condition after the variable has been dereferenced
(cherry picked from commit 9366ca769f)
2019-10-03 09:52:48 +02:00
Ondřej Surý
a70bde79e1 bin/delv/delv.c: Fix invalid logic operation in REQUIRE() condition
(cherry picked from commit 9ab16d10d4)
2019-10-03 09:51:57 +02:00
Ondřej Surý
bd5008fff5 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:51:54 +02:00
Mark Andrews
2a4a5480f9 Merge branch 'marka-cppcheck-v9_11' into 'v9_11'
Address cppcheck warnings and errors in v9_11

See merge request isc-projects/bind9!2421
2019-10-01 19:54:14 -04:00
Mark Andrews
34a3f41e9e add CHANGES 2019-10-02 09:25:00 +10:00
Ondřej Surý
66452fa91a 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.
2019-10-02 09:25:00 +10: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
983099fe61 suppress cppcheck warning: duplicateCondition 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
92a73fd1de fix cppcheck warning: identicalConditionAfterEarlyExit 2019-10-01 21:28:23 +10:00
Mark Andrews
b318d4e151 fix cppcheck error: set *listenerp to NULL. 2019-10-01 21:28:19 +10:00
Ondřej Surý
43696e0c03 Merge branch '846-dig-idn-alabel-fallback-v9_11' into 'v9_11'
Resolve "dig cannot display ACE query if locale is not unicode"

See merge request isc-projects/bind9!2414
2019-09-30 06:45:06 -04:00
Ondřej Surý
f7d5a51a5f Add CHANGES for GL #846
(cherry picked from commit dccec984c0)
2019-09-30 12:19:56 +02:00
Ondřej Surý
15cf43bb88 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 12:19:56 +02:00
Petr Menšík
bde93c8472 Emit warning on IDN output failure
Warning is emitted before any dig headers.

(cherry picked from commit 21371abd72)
2019-09-30 12:19:56 +02:00
Petr Menšík
2e77d98c63 Modify idna test to fallback to ACE
Test valid A-label on input would be displayed as A-label on output if
locale does not allow U-label.

(cherry picked from commit ac0cf85f09)
2019-09-30 12:19:56 +02:00
Petr Menšík
8e497b131c Fallback to ASCII on output IDN conversion error
It is possible dig used ACE encoded name in locale, which does not
support converting it to unicode. Instead of fatal error, fallback to
ACE name on output.

(cherry picked from commit c8a871e908)
2019-09-30 12:19:56 +02:00
Mark Andrews
2e4044fc9a Merge branch 'marka-correct-list-v9_11' into 'v9_11'
use correct list

See merge request isc-projects/bind9!2412
2019-09-28 21:17:35 -04: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ń
fc1acd581a Merge branch '147-add-windows-to-gitlab-ci-v9_11' into 'v9_11'
[v9_11] Add Windows to GitLab CI

See merge request isc-projects/bind9!2409
2019-09-27 07:00:20 -04:00
Michał Kępień
6b8d591aa1 Update Windows-specific documentation
Bring the files describing Windows-specific aspects of building and
installing BIND up to date.  Remove the parts which are either outdated
(e.g. information about libxml2 bugs) or inconvenient to keep up to date
in the long run (e.g. ARM chapter numbers).

(cherry picked from commit 646fcb733e)
2019-09-27 12:13:39 +02:00