bind9/bin/tests
Ondřej Surý ddd0d356e5 Fix 'Dereference of null pointer' from scan-build-10
These are mostly false positives, the clang-analyzer FAQ[1] specifies
why and how to fix it:

> The reason the analyzer often thinks that a pointer can be null is
> because the preceding code checked compared it against null. So if you
> are absolutely sure that it cannot be null, remove the preceding check
> and, preferably, add an assertion as well.

The 4 warnings reported are:

dnssec-cds.c:781:4: warning: Access to field 'base' results in a dereference of a null pointer (loaded from variable 'buf')
                        isc_buffer_availableregion(buf, &r);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:996:36: note: expanded from macro 'isc_buffer_availableregion'
                                   ^
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:821:16: note: expanded from macro 'ISC__BUFFER_AVAILABLEREGION'
                (_r)->base = isc_buffer_used(_b);              \
                             ^~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:152:29: note: expanded from macro 'isc_buffer_used'
        ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/
                                   ^~~~~~~~~
1 warning generated.

--

byname_test.c:308:34: warning: Access to field 'fwdtable' results in a dereference of a null pointer (loaded from variable 'view')
                RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
                                               ^~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/util.h:318:52: note: expanded from macro 'RUNTIME_CHECK'
                                                   ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/error.h:50:21: note: expanded from macro 'ISC_ERROR_RUNTIMECHECK'
        ((void)(ISC_LIKELY(cond) ||  \
                           ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/likely.h:23:43: note: expanded from macro 'ISC_LIKELY'
                                            ^
1 warning generated.

--

./rndc.c:255:6: warning: Dereference of null pointer (loaded from variable 'host')
        if (*host == '/') {
            ^~~~~
1 warning generated.

--

./main.c:1254:9: warning: Access to field 'sctx' results in a dereference of a null pointer (loaded from variable 'named_g_server')
        sctx = named_g_server->sctx;
               ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

References:
1. https://clang-analyzer.llvm.org/faq.html#null_pointer
2020-03-25 17:33:22 +01:00
..
bigtest update file headers 2018-03-15 18:33:13 -07:00
optional Fix 'Dereference of null pointer' from scan-build-10 2020-03-25 17:33:22 +01:00
pkcs11 Add ZLIB_LIBS to ISCLIBS 2020-02-28 15:22:29 +01:00
startperf Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
system Fix the tkey system test to allow parallel run 2020-03-19 17:31:31 +01:00
testdata/wire move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
win32 Make VS solution upgrading unnecessary 2019-09-26 15:11:15 +02:00
.gitignore Remove genrandom command and all usage of specific random files throughout the system test suite 2018-05-16 09:54:35 +02:00
cfg_test.c Refactor the isc_log API so it cannot fail on memory failures 2020-03-18 09:05:59 +01:00
fromhex.pl Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
headerdep_test.sh.in Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
Makefile.in Improve the backtrace to print symbols when backtrace_symbols() is available 2020-03-11 20:32:21 +01:00
makejournal.c Refactor the isc_log API so it cannot fail on memory failures 2020-03-18 09:05:59 +01:00
named.conf update documentation 2019-06-05 07:49:57 -07:00
prepare-softhsm2.sh Fix "pkcs11" system test 2020-03-04 16:06:31 +00:00
wire_test.c Reformat using the new rules 2020-02-14 09:31:05 +01:00