summaryrefslogtreecommitdiff
path: root/system/libaio/improper-strncpy-usage.patch
blob: b2f6b86a4a2004843af5f6a9fe38ac7787f3f9aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
It is invalid to use the src size as the strncpy size parameter.

Found by GCC 8.3, fixed by awilfox.

--- libaio-0.3.111/harness/cases/19.t.old	2018-03-06 22:24:47.000000000 +0000
+++ libaio-0.3.111/harness/cases/19.t	2019-02-28 22:20:03.170000000 +0000
@@ -41,7 +41,7 @@
 	int fd;
 	char template[sizeof(TEMPLATE)];
 
-	strncpy(template, TEMPLATE, sizeof(TEMPLATE));
+	strncpy(template, TEMPLATE, sizeof(template));
 	fd = mkostemp(template, O_DIRECT);
 	if (fd < 0) {
 		perror("mkstemp");
--- libaio-0.3.111/harness/cases/21.t.old	2018-03-06 22:24:47.000000000 +0000
+++ libaio-0.3.111/harness/cases/21.t	2019-02-28 22:20:13.120000000 +0000
@@ -43,7 +43,7 @@
 	int fd;
 	char temp_file[sizeof(TEMPLATE)];
 
-	strncpy(temp_file, TEMPLATE, sizeof(TEMPLATE));
+	strncpy(temp_file, TEMPLATE, sizeof(temp_file));
 	fd = mkstemp(temp_file);
 	if (fd < 0) {
 		perror("mkstemp");