summaryrefslogtreecommitdiff
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-01-17 05:27:36 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-01-17 05:27:36 +0000
commit5247e204525be5e08b6b3eb22e41ce1503010ca4 (patch)
treef5f63748c72a154a47f84781cf5ca1f7eb1ada23 /libexec/ftpd
parentb4a3678c95446a7e1155de2f9f55e7ce2d96c17c (diff)
reject SIZE request for ascii mode if file is larger than 10k.
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpcmd.y11
1 files changed, 8 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 714fb491763..8c06e2b5921 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpcmd.y,v 1.30 2002/01/08 01:55:27 millert Exp $ */
+/* $OpenBSD: ftpcmd.y,v 1.31 2002/01/17 05:27:35 itojun Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
@@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
-static char rcsid[] = "$OpenBSD: ftpcmd.y,v 1.30 2002/01/08 01:55:27 millert Exp $";
+static char rcsid[] = "$OpenBSD: ftpcmd.y,v 1.31 2002/01/17 05:27:35 itojun Exp $";
#endif
#endif /* not lint */
@@ -1508,9 +1508,14 @@ sizecmd(filename)
(void) fclose(fin);
return;
}
+ if (stbuf.st_size > 10240) {
+ reply(550, "%s: file too large for SIZE.", filename);
+ (void) fclose(fin);
+ return;
+ }
count = 0;
- while((c=getc(fin)) != EOF) {
+ while((c = getc(fin)) != EOF) {
if (c == '\n') /* will get expanded to \r\n */
count++;
count++;