summaryrefslogtreecommitdiffstats
path: root/recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch')
-rw-r--r--recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch74
1 files changed, 0 insertions, 74 deletions
diff --git a/recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch b/recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch
deleted file mode 100644
index 86a8e35f..00000000
--- a/recipes-extended/xen/files/tools-xenpmd-fix-possible-0-truncation.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1From 938c8f53b1f80175c6f7a1399efdb984abb0cb8b Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
3 <marmarek@invisiblethingslab.com>
4Date: Thu, 5 Apr 2018 03:50:53 +0200
5Subject: [PATCH] tools/xenpmd: fix possible '\0' truncation
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10gcc-8 complains:
11 xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
12 strncpy(info->oem_info, attrib_value, 32);
13 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
15 strncpy(info->battery_type, attrib_value, 32);
16 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
18 strncpy(info->serial_number, attrib_value, 32);
19 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
21 strncpy(info->model_number, attrib_value, 32);
22 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24Copy 31 chars, then make sure terminating '\0' is present. Those fields
25are passed to strlen and as '%s' for snprintf later.
26
27Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
28Acked-by: Wei Liu <wei.liu2@citrix.com>
29Release-Acked-by: Juergen Gross <jgross@suse.com>
30---
31 tools/xenpmd/xenpmd.c | 12 ++++++++----
32 1 file changed, 8 insertions(+), 4 deletions(-)
33
34diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
35index 689c8fd..56412a9 100644
36--- a/tools/xenpmd/xenpmd.c
37+++ b/tools/xenpmd/xenpmd.c
38@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name,
39
40 if ( strstr(attrib_name, "model number") )
41 {
42- strncpy(info->model_number, attrib_value, 32);
43+ strncpy(info->model_number, attrib_value, 31);
44+ info->model_number[31] = '\0';
45 return;
46 }
47
48 if ( strstr(attrib_name, "serial number") )
49 {
50- strncpy(info->serial_number, attrib_value, 32);
51+ strncpy(info->serial_number, attrib_value, 31);
52+ info->serial_number[31] = '\0';
53 return;
54 }
55
56 if ( strstr(attrib_name, "battery type") )
57 {
58- strncpy(info->battery_type, attrib_value, 32);
59+ strncpy(info->battery_type, attrib_value, 31);
60+ info->battery_type[31] = '\0';
61 return;
62 }
63
64 if ( strstr(attrib_name, "OEM info") )
65 {
66- strncpy(info->oem_info, attrib_value, 32);
67+ strncpy(info->oem_info, attrib_value, 31);
68+ info->oem_info[31] = '\0';
69 return;
70 }
71
72--
732.7.4
74