diff options
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.patch | 74 |
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 @@ | |||
1 | From 938c8f53b1f80175c6f7a1399efdb984abb0cb8b Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= | ||
3 | <marmarek@invisiblethingslab.com> | ||
4 | Date: Thu, 5 Apr 2018 03:50:53 +0200 | ||
5 | Subject: [PATCH] tools/xenpmd: fix possible '\0' truncation | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | gcc-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 | |||
24 | Copy 31 chars, then make sure terminating '\0' is present. Those fields | ||
25 | are passed to strlen and as '%s' for snprintf later. | ||
26 | |||
27 | Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> | ||
28 | Acked-by: Wei Liu <wei.liu2@citrix.com> | ||
29 | Release-Acked-by: Juergen Gross <jgross@suse.com> | ||
30 | --- | ||
31 | tools/xenpmd/xenpmd.c | 12 ++++++++---- | ||
32 | 1 file changed, 8 insertions(+), 4 deletions(-) | ||
33 | |||
34 | diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c | ||
35 | index 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 | -- | ||
73 | 2.7.4 | ||
74 | |||