summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-05-13 05:36:38 +0000
committertjr <tjr@FreeBSD.org>2004-05-13 05:36:38 +0000
commit4b192dc71d7a4ad730460b2df5ff4dcb15ffcdca (patch)
treed6ee42b325eec5f40d5143e453fbefa4d4e1714f /libexec
parent14070ec7f16e04e47540cfc00b0e31d23769ae3e (diff)
downloadFreeBSD-src-4b192dc71d7a4ad730460b2df5ff4dcb15ffcdca.zip
FreeBSD-src-4b192dc71d7a4ad730460b2df5ff4dcb15ffcdca.tar.gz
Handle variable argument lists correctly in reply() and lreply().
In particular, do not pass the same va_list to both vprintf() and vsyslog() without first reinitializing it. This fixes ftpd -d on amd64.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index dab7091..b73d954 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2380,14 +2380,17 @@ reply(int n, const char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
(void)printf("%d ", n);
+ va_start(ap, fmt);
(void)vprintf(fmt, ap);
+ va_end(ap);
(void)printf("\r\n");
(void)fflush(stdout);
if (ftpdebug) {
syslog(LOG_DEBUG, "<--- %d ", n);
+ va_start(ap, fmt);
vsyslog(LOG_DEBUG, fmt, ap);
+ va_end(ap);
}
}
@@ -2396,14 +2399,17 @@ lreply(int n, const char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
(void)printf("%d- ", n);
+ va_start(ap, fmt);
(void)vprintf(fmt, ap);
+ va_end(ap);
(void)printf("\r\n");
(void)fflush(stdout);
if (ftpdebug) {
syslog(LOG_DEBUG, "<--- %d- ", n);
+ va_start(ap, fmt);
vsyslog(LOG_DEBUG, fmt, ap);
+ va_end(ap);
}
}
OpenPOWER on IntegriCloud