[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] CVS: proftpd/src log.c, 1.96, 1.97 main.c,
From:       "TJ Saunders" <castaglia () users ! sourceforge ! net>
Date:       2009-10-26 22:09:39
Message-ID: E1N2Xkx-0001qd-Ra () ddv4jf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6908/src

Modified Files:
	log.c main.c 
Log Message:

Make the buffers used for logging and for reading client data depend on
PR_TUNABLE_PATH_MAX, which in turn depends on MAXPATHLEN (if defined by
the OS).  This makes sure that the buffers are at least large enough to
deal with the longest path supported by the OS (e.g. 4K on a Linux 2.6 kernel).


Index: log.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/log.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- log.c	30 Mar 2009 23:16:12 -0000	1.96
+++ log.c	26 Oct 2009 22:09:37 -0000	1.97
@@ -32,7 +32,8 @@
 
 #include <signal.h>
 
-#define LOGBUFFER_SIZE	2048
+/* Max path length plus 64 bytes for additional info. */
+#define LOGBUFFER_SIZE		(PR_TUNABLE_PATH_MAX + 64)
 
 static int syslog_open = FALSE;
 static int syslog_discard = FALSE;

Index: main.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/main.c,v
retrieving revision 1.387
retrieving revision 1.388
diff -u -r1.387 -r1.388
--- main.c	23 Oct 2009 16:16:09 -0000	1.387
+++ main.c	26 Oct 2009 22:09:37 -0000	1.388
@@ -96,7 +96,11 @@
 
 static unsigned char have_dead_child = FALSE;
 
-#define PR_DEFAULT_CMD_BUFSZ	512
+/* The default command buffer size SHOULD be large enough to handle the
+ * maximum path length, plus 4 bytes for the FTP command, plus 1 for the
+ * whitespace separating command from path, and 2 for the terminating CRLF.
+ */
+#define PR_DEFAULT_CMD_BUFSZ	(PR_TUNABLE_PATH_MAX + 7)
 
 /* From mod_auth_unix.c */
 extern unsigned char persistent_passwd;
@@ -553,7 +557,7 @@
 
 int pr_cmd_read(cmd_rec **res) {
   static long cmd_bufsz = -1;
-  char buf[PR_TUNABLE_BUFFER_SIZE+1] = {'\0'};
+  char buf[PR_DEFAULT_CMD_BUFSZ+1] = {'\0'};
   char *cp;
   size_t buflen;
 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic