glibc/nis
Stefan Liebler 1e0c8356f5 nis: Fix stringop-truncation warning with -O3 in nis_local_host.
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
32c7acd464
"Replace rawmemchr (s, '\0') with strchr"

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2023-03-02 14:22:54 +01:00
..
rpcsvc Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
Depend
libnsl.h Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
Makefile Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_add.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_addmember.c Replace rawmemchr (s, '\0') with strchr 2023-02-06 16:16:19 +00:00
nis_call.c Replace rawmemchr (s, '\0') with strchr 2023-02-06 16:16:19 +00:00
nis_callback.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_checkpoint.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_clone_dir.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_clone_obj.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_clone_res.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_creategroup.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_defaults.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_destroygroup.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_domain_of_r.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_domain_of.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_error.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_error.h
nis_file.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_findserv.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_free.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_getservlist.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_hash.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_intern.h Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_ismember.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_local_names.c nis: Fix stringop-truncation warning with -O3 in nis_local_host. 2023-03-02 14:22:54 +01:00
nis_lookup.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_mkdir.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_modify.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_ping.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_print_group_entry.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_print.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_remove.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_removemember.c Replace rawmemchr (s, '\0') with strchr 2023-02-06 16:16:19 +00:00
nis_rmdir.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_server.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_subr.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_table.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_util.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_verifygroup.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_xdr.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
nis_xdr.h Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
Versions Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
yp_xdr.c libnsl: Turn remaining symbols into compat symbols [BZ #22701] 2018-01-29 17:42:30 +01:00
ypclnt.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
ypupdate_xdr.c