mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-04 02:13:01 -05:00
ipa-sam: fix gcc complaints on Rawhide
In file included from /usr/include/string.h:519,
from /usr/include/lber.h:30,
from /usr/include/ldap.h:30,
from ipa_sam.c:12:
In function 'strncpy',
inlined from 'save_sid_to_secret' at ipa_sam.c:4478:2,
inlined from 'pdb_init_ipasam' at ipa_sam.c:4985:12:
/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:
@@ -4441,7 +4441,7 @@ static char *sec_key(TALLOC_CTX *mem_ctx, const char *d)
|
||||
|
||||
static NTSTATUS save_sid_to_secret(struct ipasam_private *ipasam_state)
|
||||
{
|
||||
char hostname[IPA_HOST_FQDN_LEN];
|
||||
char hostname[IPA_HOST_FQDN_LEN + 1];
|
||||
const char *fqdn;
|
||||
char *p;
|
||||
TALLOC_CTX *tmp_ctx;
|
||||
@@ -4475,7 +4475,7 @@ static NTSTATUS save_sid_to_secret(struct ipasam_private *ipasam_state)
|
||||
}
|
||||
/* Copy is necessary, otherwise we this will corrupt the static
|
||||
* buffer returned by ipa_gethostfqdn(). */
|
||||
strncpy(hostname, fqdn, sizeof(hostname));
|
||||
strncpy(hostname, fqdn, IPA_HOST_FQDN_LEN);
|
||||
p = strchr(hostname, '.');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
|
||||
Reference in New Issue
Block a user