Package: linux-ftpd / 0.17-36.2

024-failing_va_list.diff Patch series | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: Reinitialize variable argument list for vsyslog().
 The use of vprintf(fmt, ap) leaves the second argument in an
 undefined state after execution. On a system using the amd64
 architecture, this leads consistently to segmentation faults.
 The solution is to insert the required initialization before
 the call to vsyslog().
Author: Mats Erik Andersson <debian@gisladisker.se>
Forwarded: no
Last-Update: 2010-05-09
--- linux-ftpd-0.17/ftpd/ftpd.c.no-va_start
+++ linux-ftpd-0.17/ftpd/ftpd.c
@@ -2051,10 +2051,17 @@ reply(int n, char *fmt, va_dcl va_alist)
 	(void)printf("%d ", n);
 	(void)vprintf(fmt, ap);
 	(void)printf("\r\n");
+	va_end(ap);
 	(void)fflush(stdout);
 	if (debug) {
+#ifdef __STDC__
+		va_start(ap, fmt);
+#else
+		va_start(ap);
+#endif
 		syslog(LOG_FTP | LOG_DEBUG, "<--- %d ", n);
 		vsyslog(LOG_FTP | LOG_DEBUG, fmt, ap);
+		va_end(ap);
 	}
 }
 
@@ -2077,10 +2084,17 @@ lreply(n, fmt, va_alist)
 	(void)printf("%d- ", n);
 	(void)vprintf(fmt, ap);
 	(void)printf("\r\n");
+	va_end(ap);
 	(void)fflush(stdout);
 	if (debug) {
+#ifdef __STDC__
+		va_start(ap, fmt);
+#else
+		va_start(ap);
+#endif
 		syslog(LOG_FTP | LOG_DEBUG, "<--- %d- ", n);
 		vsyslog(LOG_FTP | LOG_DEBUG, fmt, ap);
+		va_end(ap);
 	}
 }