]>
Commit | Line | Data |
---|---|---|
a010b409 SI |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Joao Carlos Mendes Luis <dioni21@users.noreply.github.com> | |
3 | Date: Sun, 26 Aug 2018 16:55:44 -0300 | |
4 | Subject: [PATCH] Fedora 28: Fix misc bounds check compiler warnings | |
5 | ||
6 | Fix a bunch of truncation compiler warnings that show up | |
7 | on Fedora 28 (GCC 8.0.1). | |
8 | ||
9 | Reviewed-by: Giuseppe Di Natale <guss80@gmail.com> | |
10 | Reviewed-by: George Melikov <mail@gmelikov.ru> | |
11 | Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
12 | Issue #7368 | |
13 | Closes #7826 | |
14 | Closes #7830 | |
15 | ||
16 | Signed-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 | ||
23 | diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c | |
24 | index 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; | |
36 | diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c | |
37 | index 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); | |
49 | diff --git a/tests/zfs-tests/tests/functional/ctime/ctime.c b/tests/zfs-tests/tests/functional/ctime/ctime.c | |
50 | index 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 |