#50814 Fix latest compiler warnings
Closed: wontfix 3 years ago by spichugi. Opened 4 years ago by mreynolds.

Issue Description

Found on Fedora 32.

We should fix these, and some of them also show up in cov scans. Would be nice to get this all cleaned up:

ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c: In function 'bdb_delete_database_ex':
ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c:4224:22: warning: variable 'priv' set but not used [-Wunused-but-set-variable]
 4224 |     dblayer_private *priv = NULL;
      |                      ^~~~
ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c: In function 'bdb_get_aux_id2entry_ext':
ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c:1926:8: warning: 'priv' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1926 |     if (priv) {
      |        ^



                 from ldap/servers/snmp/main.c:15:
In function 'strncpy',
    inlined from 'main' at ldap/servers/snmp/main.c:151:17:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/snmp/main.c: In function 'main':
ldap/servers/snmp/main.c:151:63: note: length computed here
  151 |                 strncpy((char *)log_hdl->token, agent_logdir, strlen(agent_logdir) + 1);
      |                                                               ^~~~~~~~~~~~~~~~~~~~





ldap/servers/slapd/result.c: In function 'notes2str':
ldap/servers/slapd/result.c:1959:13: warning: value computed is not used [-Wunused-value]
 1959 |             *p--;
      |             ^~~~




protection -fcf-protection -c ldap/servers/plugins/syntaxes/string.c  -fPIC -DPIC -o ldap/servers/plugins/syntaxes/.libs/libsyntax_plugin_la-string.o
In file included from /usr/include/string.h:495,
                 from ldap/servers/plugins/syntaxes/string.c:17:
In function 'strncpy',
    inlined from 'string_filter_sub' at ldap/servers/plugins/syntaxes/string.c:345:13:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 8192 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





unwind-tables -fstack-clash-protection -fcf-protection -c ldap/servers/plugins/acl/aclparse.c  -fPIC -DPIC -o ldap/servers/plugins/acl/.libs/libacl_plugin_la-aclparse.o
In file included from /usr/include/string.h:495,
                 from ldap/servers/plugins/acl/acl.h:24,
                 from ldap/servers/plugins/acl/aclparse.c:14:
In function 'strncpy',
    inlined from '__aclp__parse_aci' at ldap/servers/plugins/acl/aclparse.c:266:17,
    inlined from 'acl_parse' at ldap/servers/plugins/acl/aclparse.c:94:24:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying 1 byte from a string of the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from '__aclp__parse_aci' at ldap/servers/plugins/acl/aclparse.c:348:17,
    inlined from 'acl_parse' at ldap/servers/plugins/acl/aclparse.c:94:24:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying 1 byte from a string of the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from '__aclp__parse_aci' at ldap/servers/plugins/acl/aclparse.c:401:17,
    inlined from 'acl_parse' at ldap/servers/plugins/acl/aclparse.c:94:24:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying 1 byte from a string of the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






In file included from /usr/include/stdio.h:867,
                 from ldap/servers/slapd/tools/ldclt/ldapfct.c:27:
In function 'printf',
    inlined from 'connectToLDAP' at ldap/servers/slapd/tools/ldclt/ldapfct.c:700:17:
/usr/include/bits/stdio2.h:107:10: warning: '%s' directive argument is null [-Wformat-overflow=]
  107 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I.     -I./ldap/servers/slapd/tools -DBUILD_NUM=\"2020.013.00\" -DVENDOR="\"389 Project\"" -DBRAND="\"389\"" -DCAPBRAND="\"389\"" -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT -I./ldap/include -I./ldap/servers/slapd -I./include -I. -DLOCALSTATEDIR="\"/var\"" -DSYSCONFDIR="\"/etc\"" -DLIBDIR="\"/usr/lib64\"" -DBINDIR="\"/usr/bin\"" -DDATADIR="\"/usr/share\"" -DDOCDIR="\"/usr/share/doc/389-ds-base\"" -DSBINDIR="\"/usr/sbin\"" -DPLUGINDIR="\"/usr/lib64/dirsrv/plugins\"" -DTEMPLATEDIR="\"/usr/share/dirsrv/data\"" -DSYSTEMSCHEMADIR="\"/usr/share/dirsrv/schema\"" -DWITH_SYSTEMD -I/usr/include -I/usr/include/nss3 -I/usr/include/nspr4  -I/usr/include/nspr4     -g -O2 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1     -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o ldap/servers/slapd/tools/ldclt/ldclt-ldclt.o `test -f 'ldap/servers/slapd/tools/ldclt/ldclt.c' || echo './'`ldap/servers/slapd/tools/ldclt/ldclt.c
In file included from /usr/include/string.h:495,
                 from ldap/servers/slapd/tools/ldclt/ldclt.c:36:
In function 'strncpy',
    inlined from 'basicInit' at ldap/servers/slapd/tools/ldclt/ldclt.c:1164:9:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/tools/ldclt/ldclt.c: In function 'basicInit':
ldap/servers/slapd/tools/ldclt/ldclt.c:1164:9: note: length computed here
 1164 |         strncpy(mctx.attRefDef, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:495,
                 from ldap/servers/slapd/tools/ldclt/ldclt.c:36:
In function 'strncpy',
    inlined from 'basicInit' at ldap/servers/slapd/tools/ldclt/ldclt.c:1193:9:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldap/servers/slapd/tools/ldclt/ldclt.c: In function 'basicInit':
ldap/servers/slapd/tools/ldclt/ldclt.c:1193:9: note: length computed here
 1193 |         strncpy(mctx.attrplFile, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



In file included from /usr/include/string.h:495,
                 from ldap/servers/slapd/tools/ldclt/threadMain.c:122:
In function 'strncpy',
    inlined from 'msgIdAdd' at ldap/servers/slapd/tools/ldclt/threadMain.c:538:5:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 1024 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'msgIdAdd' at ldap/servers/slapd/tools/ldclt/threadMain.c:540:5:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound 1024 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata Update from @mreynolds:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None
- Issue set to the milestone: 1.4.3

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/3868

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata