]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fedora 28: Fix misc bounds check compiler warnings
authorJoao Carlos Mendes Luis <dioni21@users.noreply.github.com>
Sun, 26 Aug 2018 19:55:44 +0000 (16:55 -0300)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 26 Aug 2018 19:55:44 +0000 (12:55 -0700)
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

lib/libshare/smb.c
module/icp/core/kcf_mech_tabs.c
tests/zfs-tests/tests/functional/ctime/ctime.c

index ffae5699c0161f3a87981b345b7692f1ff01f0e4..4c2045dfdb4d128286ad87eec64a6840a2e50c6d 100644 (file)
@@ -219,7 +219,7 @@ smb_enable_share_one(const char *sharename, const char *sharepath)
        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;
index 723bfdb601a49d425eed0d366d1b276b2d2b7487..741dae7a748e5beb432c0d3a5fd91d360027ea99 100644 (file)
@@ -321,7 +321,7 @@ kcf_create_mech_entry(kcf_ops_class_t class, char *mechname)
                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);
index ba8af15fec9be162eeff0def68ef18fa9307ba01..1cd183234012eb5f93feafd62b292a38e7be763d 100644 (file)
@@ -155,7 +155,7 @@ do_link(const char *pfile)
                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