bind9/bin/tests/optional
Ondřej Surý 0ff5c1f10d 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 2 warnings reported are:

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.

References:
1. https://clang-analyzer.llvm.org/faq.html#null_pointer

(cherry picked from commit ddd0d356e5)
(cherry picked from commit 9b76eea08f)
2020-03-25 18:27:08 +01:00
..
.gitignore Add backtrace_test and nsecify to bin/tests/optional/.gitignore 2018-05-31 12:06:51 +02:00
adb_test.c isc_mutex_init returns 'void' 2018-11-22 11:51:49 +00:00
backtrace_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
byaddr_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
byname_test.c Fix 'Dereference of null pointer' from scan-build-10 2020-03-25 18:27:08 +01:00
db_test.c Remove isc_mem_{set,get}quota unused functions 2018-11-22 16:46:56 +01:00
fsaccess_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
gsstest.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
inter_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
Kchild.example.+005+33180.key Convert the bin/tests/optional/sig0_test.c to use RSASHA1 instead of DSA 2018-10-26 11:50:11 +02:00
Kchild.example.+005+33180.private Convert the bin/tests/optional/sig0_test.c to use RSASHA1 instead of DSA 2018-10-26 11:50:11 +02:00
lex_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
lfsr_test.c Replace custom isc_u?intNN_t types with C99 u?intNN_t types 2018-08-08 09:37:28 +02:00
log_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
Makefile.in add a search for GeoIP2 libraries in configure 2019-06-27 16:25:28 -07:00
master_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
mempool_test.c - Make isc_mutex_destroy return void 2018-11-22 11:52:08 +00:00
name_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
nsecify.c address or suppress cppcheck warnings 2019-09-12 19:27:28 +10:00
ratelimiter_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
rbt_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
rbt_test.out move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
rbt_test.txt move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
rwlock_test.c Remove unthreaded support 2018-08-16 17:18:52 +02:00
serial_test.c memmove, strtoul, and strcasestr functions are part of ISO C90, remove the compatibility shim 2018-08-28 10:31:48 +02:00
shutdown_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
sig0_test.c - Make isc_mutex_destroy return void 2018-11-22 11:52:08 +00:00
sock_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
sym_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
task_test.c move all optional tests from bin/tests to bin/tests/optional 2018-03-09 14:12:47 -08:00
timer_test.c Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
zone_test.c tests: Workaround scan-build false positive with FD_ZERO/FD_SET 2019-11-05 09:48:50 +01:00