gcc-10+ -fanalyzer reports: dereference of NULL ‘label’ in lib/dns/name.c:1167
Full report:
name.c: In function ‘dns_name_fromtext’:
name.c:1167:40: error: dereference of NULL ‘label’ [CWE-476] [-Werror=analyzer-null-dereference]
1167 | *label = count;
| ~~~~~~~^~~~~~~
‘dns_name_fromstring’: events 1-2
|
| 2429 | dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options,
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (1) entry to ‘dns_name_fromstring’
| 2430 | isc_mem_t *mctx) {
| 2431 | return (dns_name_fromstring2(target, src, dns_rootname, options, mctx));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (2) calling ‘dns_name_fromstring2’ from ‘dns_name_fromstring’
|
+--> ‘dns_name_fromstring2’: event 3
|
| 2435 | dns_name_fromstring2(dns_name_t *target, const char *src,
| | ^~~~~~~~~~~~~~~~~~~~
| | |
| | (3) entry to ‘dns_name_fromstring2’
|
‘dns_name_fromstring2’: event 4
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (4) following ‘true’ branch (when ‘src’ is non-NULL)...
name.c:2443:9: note: in expansion of macro ‘REQUIRE’
| 2443 | REQUIRE(src != NULL);
| | ^~~~~~~
|
‘dns_name_fromstring2’: event 5
|
|../../lib/isc/include/isc/buffer.h:1051:9:
| 1051 | do { \
| | ^~
| | |
| | (5) ...to here
name.c:2445:9: note: in expansion of macro ‘isc_buffer_constinit’
| 2445 | isc_buffer_constinit(&buf, src, strlen(src));
| | ^~~~~~~~~~~~~~~~~~~~
|
‘dns_name_fromstring2’: event 6
|
| 2453 | result = dns_name_fromtext(name, &buf, origin, options, NULL);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (6) calling ‘dns_name_fromtext’ from ‘dns_name_fromstring2’
|
+--> ‘dns_name_fromtext’: event 7
|
| 1057 | dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
| | ^~~~~~~~~~~~~~~~~
| | |
| | (7) entry to ‘dns_name_fromtext’
|
‘dns_name_fromtext’: event 8
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (8) following ‘true’ branch...
name.c:1082:9: note: in expansion of macro ‘REQUIRE’
| 1082 | REQUIRE(VALID_NAME(name));
| | ^~~~~~~
|
‘dns_name_fromtext’: event 9
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (9) ...to here
name.c:1083:9: note: in expansion of macro ‘REQUIRE’
| 1083 | REQUIRE(ISC_BUFFER_VALID(source));
| | ^~~~~~~
|
‘dns_name_fromtext’: event 10
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (10) following ‘true’ branch...
name.c:1083:9: note: in expansion of macro ‘REQUIRE’
| 1083 | REQUIRE(ISC_BUFFER_VALID(source));
| | ^~~~~~~
|
‘dns_name_fromtext’: event 11
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (11) ...to here
name.c:1084:9: note: in expansion of macro ‘REQUIRE’
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ^~~~~~~
|
‘dns_name_fromtext’: event 12
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (12) following ‘false’ branch (when ‘target’ is NULL)...
name.c:1084:9: note: in expansion of macro ‘REQUIRE’
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ^~~~~~~
|
‘dns_name_fromtext’: event 13
|
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| | |
| | (13) ...to here
| 1085 | (target == NULL && ISC_BUFFER_VALID(name->buffer)));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name.c:1084:9: note: in expansion of macro ‘REQUIRE’
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ^~~~~~~
|
‘dns_name_fromtext’: event 14
|
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| | |
| | (14) following ‘true’ branch...
| 1085 | (target == NULL && ISC_BUFFER_VALID(name->buffer)));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name.c:1084:9: note: in expansion of macro ‘REQUIRE’
| 1084 | REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) ||
| | ^~~~~~~
|
‘dns_name_fromtext’: events 15-17
|
| 1087 | downcase = ((options & DNS_NAME_DOWNCASE) != 0);
| | ^~~~~~~~
| | |
| | (15) ...to here
| 1088 |
| 1089 | if (target == NULL && name->buffer != NULL) {
| | ~
| | |
| | (16) following ‘true’ branch...
| 1090 | target = name->buffer;
| | ~~~~~~
| | |
| | (17) ...to here
|
‘dns_name_fromtext’: event 18
|
|../../lib/isc/include/isc/util.h:287:20:
| 287 | #define REQUIRE(e) assert(e)
| | ^~~~~~
| | |
| | (18) following ‘true’ branch...
name.c:1094:9: note: in expansion of macro ‘REQUIRE’
| 1094 | REQUIRE(BINDABLE(name));
| | ^~~~~~~
|
‘dns_name_fromtext’: event 19
|
| 96 | if ((name)->offsets != NULL) \
| | ^~
| | |
| | (19) ...to here
name.c:1096:9: note: in expansion of macro ‘INIT_OFFSETS’
| 1096 | INIT_OFFSETS(name, offsets, odata);
| | ^~~~~~~~~~~~
|
‘dns_name_fromtext’: events 20-26
|
| 1120 | while (nrem > 0 && tlen > 0 && !done) {
| | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
| | |
| | (20) following ‘true’ branch...
| | (21) ...to here
| | (22) following ‘false’ branch (when ‘done == 0’)...
| 1121 | c = *tdata++;
| | ~
| | |
| | (23) ...to here
|......
| 1125 | switch (state) {
| | ~~~~~~
| | |
| | (24) following ‘case 0:’ branch...
| 1126 | case ft_init:
| | ~~~~
| | |
| | (25) ...to here
|......
| 1141 | if (c == '@' && tlen == 0) {
| | ~
| | |
| | (26) following ‘true’ branch...
|
‘dns_name_fromtext’: event 27
|
|cc1:
| (27): ...to here
|
‘dns_name_fromtext’: events 28-42
|
|