[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.108, 1.109

cras at dovecot.org cras at dovecot.org
Sun Feb 5 15:03:43 EET 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv30709/lib-storage/index/maildir

Modified Files:
	maildir-storage.c 
Log Message:
Limit maximum mailbox name length while creating them.



Index: maildir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- maildir-storage.c	18 Jan 2006 23:14:44 -0000	1.108
+++ maildir-storage.c	5 Feb 2006 13:03:41 -0000	1.109
@@ -18,6 +18,10 @@
 
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
+/* Don't allow creating too long mailbox names. They could start causing
+   problems when they reach the limit. */
+#define MAILDIR_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
+
 struct rename_context {
 	bool found;
 	size_t oldnamelen;
@@ -179,8 +183,8 @@
 	size_t len;
 
 	len = strlen(name);
-	if (len == 0 || name[0] == MAILDIR_FS_SEP ||
-	    name[len-1] == MAILDIR_FS_SEP ||
+	if (len == 0 || len > MAILDIR_MAX_MAILBOX_NAME_LENGTH ||
+	    name[0] == MAILDIR_FS_SEP || name[len-1] == MAILDIR_FS_SEP ||
 	    strchr(name, '*') != NULL || strchr(name, '%') != NULL)
 		return FALSE;
 



More information about the dovecot-cvs mailing list