summaryrefslogtreecommitdiff
path: root/system/sysvinit/bounds.patch
blob: bf30d56e278c114250092b650aefc6ca728c8225 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- sysvinit-3.14/src/dowall.c.old	2025-06-24 02:38:56.414501867 -0500
+++ sysvinit-3.14/src/dowall.c	2025-06-25 01:36:34.943110622 -0500
@@ -44,6 +44,7 @@
 #ifndef HOST_NAME_MAX
 # define HOST_NAME_MAX	255
 #endif
+#define MIN(a,b) (((a)<(b))?(a):(b))
 
 static sigjmp_buf jbuf;
 
@@ -226,7 +227,7 @@
 		   utmp->ut_user[0] == 0) continue;
 		if (strncmp(utmp->ut_line, _PATH_DEV, strlen(_PATH_DEV)) == 0) {
 			term[0] = 0;
-			strncat(term, utmp->ut_line, sizeof(term)-1);
+			strncat(term, utmp->ut_line, MIN(UT_LINESIZE,sizeof(term)-1));
 		} else
 			snprintf(term, sizeof(term), _PATH_DEV "%.*s",
 				UT_LINESIZE, utmp->ut_line);