bind9/bin/dnssec
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
..
win32 dnssec-keygen can create keys given dnssec-policy 2019-11-06 22:31:45 +01:00
.gitignore [master] dnssec-cds 2017-10-05 01:04:18 -07:00
dnssec-cds.8 fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-cds.c Fix 'Dereference of null pointer' from scan-build-10 2020-03-25 17:33:22 +01:00
dnssec-cds.docbook fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-cds.html fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-dsfromkey.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-dsfromkey.c Reformat using the new rules 2020-02-14 09:31:05 +01:00
dnssec-dsfromkey.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-dsfromkey.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-importkey.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-importkey.c Reformat using the new rules 2020-02-14 09:31:05 +01:00
dnssec-importkey.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-importkey.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-keyfromlabel.8 Rebuild documentation 2020-02-23 20:48:55 -08:00
dnssec-keyfromlabel.c Use the new sorting rules to regroup #include headers 2020-03-09 16:19:22 +01:00
dnssec-keyfromlabel.docbook Remove reference to prepending label with engine in manpage 2020-02-10 07:30:19 -08:00
dnssec-keyfromlabel.html Rebuild documentation 2020-02-23 20:48:55 -08:00
dnssec-keygen.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-keygen.c Use the new sorting rules to regroup #include headers 2020-03-09 16:19:22 +01:00
dnssec-keygen.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-keygen.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-revoke.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-revoke.c Reformat using the new rules 2020-02-14 09:31:05 +01:00
dnssec-revoke.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-revoke.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-settime.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-settime.c Add C11 localtime_r and gmtime_r shims for Windows 2020-03-17 13:28:15 -07:00
dnssec-settime.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-settime.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-signzone.8 fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-signzone.c Add C11 localtime_r and gmtime_r shims for Windows 2020-03-17 13:28:15 -07:00
dnssec-signzone.docbook fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-signzone.html fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
dnssec-verify.8 prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssec-verify.c Reformat using the new rules 2020-02-14 09:31:05 +01:00
dnssec-verify.docbook update copyright year to 2020 2020-01-02 21:45:30 -08:00
dnssec-verify.html prep 9.15.8 2020-01-16 08:01:20 +00:00
dnssectool.c Refactor the isc_log API so it cannot fail on memory failures 2020-03-18 09:05:59 +01:00
dnssectool.h Reformat using the new rules 2020-02-14 09:31:05 +01:00
Makefile.in Remove support for internal symbol table 2020-03-11 11:13:52 +01:00