mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
1e0c8356f5
When building with -O3 on s390x/x86_64, I get this stringop-truncation warning
which leads to a build fail:
In function ‘nis_local_host’,
inlined from ‘nis_local_host’ at nis_local_names.c:147:1:
nis_local_names.c:171:11: error: ‘strncpy’ output may be truncated copying between 0 and 1023 bytes from a string of length 1024 [-Werror=stringop-truncation]
171 | strncpy (cp, nis_local_directory (), NIS_MAXNAMELEN - len -1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We can just ignore this warning as the hostname + '.' + directory-name + '\0' always fits
in __nishostname with length of (NIS_MAXNAMELEN + 1) as there is the runtime check above.
Furthermore as we already know the length of the directory-name, we can also just use
memcpy to copy the directory-name inclusive the NUL-termination.
Note: This werror was introduced with commit
|
||
---|---|---|
.. | ||
rpcsvc | ||
Depend | ||
libnsl.h | ||
Makefile | ||
nis_add.c | ||
nis_addmember.c | ||
nis_call.c | ||
nis_callback.c | ||
nis_checkpoint.c | ||
nis_clone_dir.c | ||
nis_clone_obj.c | ||
nis_clone_res.c | ||
nis_creategroup.c | ||
nis_defaults.c | ||
nis_destroygroup.c | ||
nis_domain_of_r.c | ||
nis_domain_of.c | ||
nis_error.c | ||
nis_error.h | ||
nis_file.c | ||
nis_findserv.c | ||
nis_free.c | ||
nis_getservlist.c | ||
nis_hash.c | ||
nis_intern.h | ||
nis_ismember.c | ||
nis_local_names.c | ||
nis_lookup.c | ||
nis_mkdir.c | ||
nis_modify.c | ||
nis_ping.c | ||
nis_print_group_entry.c | ||
nis_print.c | ||
nis_remove.c | ||
nis_removemember.c | ||
nis_rmdir.c | ||
nis_server.c | ||
nis_subr.c | ||
nis_table.c | ||
nis_util.c | ||
nis_verifygroup.c | ||
nis_xdr.c | ||
nis_xdr.h | ||
Versions | ||
yp_xdr.c | ||
ypclnt.c | ||
ypupdate_xdr.c |