aboutsummaryrefslogtreecommitdiff
path: root/misc/pinfo/gcc10-stringop.diff
blob: a57fa91d08d98a7ea9f749c0f444404e3e8622a4 (plain)
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
27
28
diff --git a/src/utils.c b/src/utils.c
index cb2fe76..2e4139c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -848,10 +848,9 @@ char *
 make_tempfile()
 {
 	char *filename;
-	size_t len;
 
 	/* TODO: fix hardcoded /tmp */
-	char tmpfile_template[] = "/tmp/pinfo.XXXXXX";
+	char tmpfile_template[32] = "/tmp/pinfo.XXXXXX";
 
 	/* create a tmpfile */
 	int fd = mkstemp(tmpfile_template);
@@ -864,9 +863,8 @@ make_tempfile()
 	}
 
 	/* allocate a new string and copy the filename there */
-	len = strlen(tmpfile_template)+1;
-	filename = xmalloc(len+1); /* guarenteerd to be set to \0's */
-	strncpy(filename, tmpfile_template, len);
+	filename = xmalloc(33); /* guarenteerd to be set to \0's */
+	strncpy(filename, tmpfile_template, 32);
 
 	/* close the file */
 	close(fd);