ipa-kdb: fix gcc complaints

In file included from /usr/include/string.h:519,
                 from /usr/include/lber.h:30,
                 from /usr/include/ldap.h:30,
                 from ipa_kdb.h:37,
                 from ipa_kdb_mspac.c:26:
In function 'strncpy',
    inlined from 'get_server_netbios_name' at ipa_kdb_mspac.c:2358:5,
    inlined from 'ipadb_reinit_mspac' at ipa_kdb_mspac.c:2813:39:
/usr/include/bits/string_fortified.h:91:10: warning: 'strncpy' specified bound 255 equals destination size [-Wstringop-truncation]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: https://pagure.io/freeipa/issue/8585
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Alexander Bokovoy 2020-11-13 13:31:51 +02:00
parent 0d67180f7d
commit f513a55ded

View File

@ -2352,7 +2352,7 @@ done:
static char *get_server_netbios_name(struct ipadb_context *ipactx) static char *get_server_netbios_name(struct ipadb_context *ipactx)
{ {
char hostname[IPA_HOST_FQDN_LEN]; /* NOTE: long enough for DNS name */ char hostname[IPA_HOST_FQDN_LEN + 1]; /* NOTE: long enough for DNS name */
char *p; char *p;
strncpy(hostname, ipactx->kdc_hostname, IPA_HOST_FQDN_LEN); strncpy(hostname, ipactx->kdc_hostname, IPA_HOST_FQDN_LEN);