]> git.proxmox.com Git - zfsonlinux.git/blame - zfs-patches/0028-Fedora-28-Fix-misc-bounds-check-compiler-warnings.patch
bump version to 0.7.11-pve1~bpo1
[zfsonlinux.git] / zfs-patches / 0028-Fedora-28-Fix-misc-bounds-check-compiler-warnings.patch
CommitLineData
a010b409
SI
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Joao Carlos Mendes Luis <dioni21@users.noreply.github.com>
3Date: Sun, 26 Aug 2018 16:55:44 -0300
4Subject: [PATCH] Fedora 28: Fix misc bounds check compiler warnings
5
6Fix a bunch of truncation compiler warnings that show up
7on Fedora 28 (GCC 8.0.1).
8
9Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
10Reviewed-by: George Melikov <mail@gmelikov.ru>
11Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
12Issue #7368
13Closes #7826
14Closes #7830
15
16Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
17---
18 lib/libshare/smb.c | 2 +-
19 module/icp/core/kcf_mech_tabs.c | 2 +-
20 tests/zfs-tests/tests/functional/ctime/ctime.c | 2 +-
21 3 files changed, 3 insertions(+), 3 deletions(-)
22
23diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c
24index 76145bd9..91d4decb 100644
25--- a/lib/libshare/smb.c
26+++ b/lib/libshare/smb.c
27@@ -218,7 +218,7 @@ smb_enable_share_one(const char *sharename, const char *sharepath)
28 int rc;
29
30 /* Support ZFS share name regexp '[[:alnum:]_-.: ]' */
31- strncpy(name, sharename, sizeof (name));
32+ strlcpy(name, sharename, sizeof (name));
33 name [sizeof (name)-1] = '\0';
34
35 pos = name;
36diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c
37index 723bfdb6..741dae7a 100644
38--- a/module/icp/core/kcf_mech_tabs.c
39+++ b/module/icp/core/kcf_mech_tabs.c
40@@ -321,7 +321,7 @@ kcf_create_mech_entry(kcf_ops_class_t class, char *mechname)
41 mutex_enter(&(me_tab[i].me_mutex));
42 if (me_tab[i].me_name[0] == 0) {
43 /* Found an empty spot */
44- (void) strncpy(me_tab[i].me_name, mechname,
45+ (void) strlcpy(me_tab[i].me_name, mechname,
46 CRYPTO_MAX_MECH_NAME);
47 me_tab[i].me_name[CRYPTO_MAX_MECH_NAME-1] = '\0';
48 me_tab[i].me_mechid = KCF_MECHID(class, i);
49diff --git a/tests/zfs-tests/tests/functional/ctime/ctime.c b/tests/zfs-tests/tests/functional/ctime/ctime.c
50index ba8af15f..1cd18323 100644
51--- a/tests/zfs-tests/tests/functional/ctime/ctime.c
52+++ b/tests/zfs-tests/tests/functional/ctime/ctime.c
53@@ -155,7 +155,7 @@ do_link(const char *pfile)
54 return (-1);
55 }
56
57- strncpy(pfile_copy, pfile, sizeof (pfile_copy));
58+ strncpy(pfile_copy, pfile, sizeof (pfile_copy)-1);
59 pfile_copy[sizeof (pfile_copy) - 1] = '\0';
60 /*
61 * Figure out source file directory name, and create