summaryrefslogtreecommitdiff
path: root/libexec/ftpd/ftpd.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2010-06-18 06:02:58 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2010-06-18 06:02:58 +0000
commit2e5f1c66c8d48de25f7c9637a5ced12b2dfe0447 (patch)
treebd74bd0ed488a4a97267355461381add9bd66721 /libexec/ftpd/ftpd.c
parenta09754206567af6ad8f620a1ae74d7220daad7dc (diff)
Prevent a segmentation fault on ftpd_popen error (memory, file descriptor,
pipe ...) during status command. ok millert
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r--libexec/ftpd/ftpd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 2cbac1cb662..1f65a156ced 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.188 2010/06/13 15:27:46 tobias Exp $ */
+/* $OpenBSD: ftpd.c,v 1.189 2010/06/18 06:02:57 tobias Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -1758,6 +1758,10 @@ statfilecmd(char *filename)
(void)snprintf(line, sizeof(line), "/bin/ls -lgA %s", filename);
fin = ftpd_popen(line, "r");
+ if (fin == NULL) {
+ reply(451, "Local resource failure");
+ return;
+ }
lreply(211, "status of %s:", filename);
atstart = 1;
while ((c = getc(fin)) != EOF) {