[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.5, 1.6

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/dbox
In directory talvi:/tmp/cvs-serv30709/lib-storage/index/dbox

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



Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dbox-storage.c	18 Jan 2006 23:14:44 -0000	1.5
+++ dbox-storage.c	5 Feb 2006 13:03:40 -0000	1.6
@@ -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 DBOX_MAX_MAILBOX_NAME_LENGTH (PATH_MAX/2)
+
 struct rename_context {
 	bool found;
 	size_t oldnamelen;
@@ -178,7 +182,8 @@
 
 	len = strlen(name);
 	if (name[0] == '\0' || name[len-1] == '/' ||
-	    strchr(name, '*') != NULL || strchr(name, '%') != NULL)
+	    strchr(name, '*') != NULL || strchr(name, '%') != NULL ||
+	    len > DBOX_MAX_MAILBOX_NAME_LENGTH)
 		return FALSE;
 
 	return dbox_is_valid_mask(storage, name);



More information about the dovecot-cvs mailing list