Fix a bunch of truncation compiler warnings that show up
on Fedora 28 (GCC 8.0.1).
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #7368
Closes #7826
Closes #7830
int rc;
/* Support ZFS share name regexp '[[:alnum:]_-.: ]' */
- strncpy(name, sharename, sizeof (name));
+ strlcpy(name, sharename, sizeof (name));
name [sizeof (name)-1] = '\0';
pos = name;
mutex_enter(&(me_tab[i].me_mutex));
if (me_tab[i].me_name[0] == 0) {
/* Found an empty spot */
- (void) strncpy(me_tab[i].me_name, mechname,
+ (void) strlcpy(me_tab[i].me_name, mechname,
CRYPTO_MAX_MECH_NAME);
me_tab[i].me_name[CRYPTO_MAX_MECH_NAME-1] = '\0';
me_tab[i].me_mechid = KCF_MECHID(class, i);
return (-1);
}
- strncpy(pfile_copy, pfile, sizeof (pfile_copy));
+ strncpy(pfile_copy, pfile, sizeof (pfile_copy)-1);
pfile_copy[sizeof (pfile_copy) - 1] = '\0';
/*
* Figure out source file directory name, and create