File: 0005-workaround-gcc-lintian.patch

package info (click to toggle)
sysvinit 3.08-3~bpo12%2B2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 3,104 kB
  • sloc: ansic: 8,437; sh: 3,794; makefile: 330
file content (29 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (2)
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
29
# DP: lintian finds “characte” in the source and tags it as a
# DP: spelling mistake, but it’s an artefact of GCC inlining
# DP: the strcpy call below; unify the way how err is produced
# DP: and use a secure string function while at it

--- a/src/init.c
+++ b/src/init.c
@@ -1568,12 +1568,17 @@
 	if (!action || !*action)
 			strcpy(err, "missing action field");
 	if (id && strlen(id) > sizeof(utproto.ut_id))
-		sprintf(err, "id field too long (max %d characters)",
-			(int)sizeof(utproto.ut_id));
+		snprintf(err, sizeof(err),
+		    "%s field too long (max %d characters)",
+		    "id", (int)sizeof(utproto.ut_id));
 	if (rlevel && strlen(rlevel) > 11)
-		strcpy(err, "rlevel field too long (max 11 characters)");
+		snprintf(err, sizeof(err),
+		    "%s field too long (max %d characters)",
+		    "rlevel", 11);
 	if (process && strlen(process) > 127)
-		strcpy(err, "process field too long (max 127 characters)");
+		snprintf(err, sizeof(err),
+		    "%s field too long (max %d characters)",
+		    "process", 127);
 	if (action && strlen(action) > 32)
 		strcpy(err, "action field too long");
 	if (err[0] != 0) {