bind9/lib
Matthijs Mekking abd8c1cad0 Fix CID 432259: Sizeof not portable (remote.c)
The following report suggests that the 'size' parameter in the two
calls to 'isc_mem_get()' should be set to the
'count * sizeof(*tlsnames)' and 'count * sizeof(*keynames)'
respectively.

/lib/dns/remote.c: 117 in dns_remote_init()
111		}
112	} else {
113		remote->keynames = NULL;
114	}
115
116	if (tlsnames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (tlsnames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to
>>>	"sizeof (dns_name_t *)", but this is not a portable assumption.

117	remote->tlsnames = isc_mem_get(mctx, count * sizeof(tlsnames));
118		for (i = 0; i < count; i++) {
119			remote->tlsnames[i] = NULL;
120		}
121		for (i = 0; i < count; i++) {
122			if (tlsnames[i] != NULL) {

/lib/dns/remote.c: 99 in dns_remote_init()
93		memmove(remote->dscps, dscp, count * sizeof(isc_dscp_t));
94	} else {
95		remote->dscps = NULL;
96	}
97
98	if (keynames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (keynames) */" to
>>>	function "isc__mem_get" and then casting the return value to
>>>	"dns_name_t **" is suspicious.  In this particular case
>>>	"sizeof (dns_name_t **)" happens to be equal to "sizeof
>>>	(dns_name_t *)", but this is not a portable assumption.

99	 remote->keynames = isc_mem_get(mctx, count * sizeof(keynames));
100	 for (i = 0; i < count; i++) {
101		remote->keynames[i] = NULL;
102	 }
103	 for (i = 0; i < count; i++) {
104		if (keynames[i] != NULL) {
2023-01-03 16:47:57 +01:00
..
bind9 Update sources to Clang 15 formatting 2022-11-29 08:54:34 +01:00
dns Fix CID 432259: Sizeof not portable (remote.c) 2023-01-03 16:47:57 +01:00
irs Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
isc Do not pass NULL pointer to memmove - undefined behaviour 2023-01-03 14:40:30 +11:00
isccc Change the isc_buffer_reserve() to take just buffer pointer 2022-12-20 19:13:48 +01:00
isccfg Remove setting alternate transfer source 2022-12-23 14:39:59 +01:00
ns BIND: use Stream DNS for DNS over TCP connections 2022-12-20 22:13:53 +02:00
.gitignore The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
Makefile.am move samples/resolve.c to bin/tests/system 2021-04-16 14:29:43 +02:00