]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Disallow control characters in mailbox names when creating them.
authorTimo Sirainen <tss@iki.fi>
Fri, 7 Aug 2009 18:21:40 +0000 (14:21 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 7 Aug 2009 18:21:40 +0000 (14:21 -0400)
--HG--
branch : HEAD

src/lib-storage/mailbox-list.c

index ac7bbe31e907d52d8ee1e28196bc845e5a94f467..fa2bc8c69b8e9f74badd9cd93314b9fe7f5bd23e 100644 (file)
@@ -485,8 +485,15 @@ bool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
 bool mailbox_list_is_valid_create_name(struct mailbox_list *list,
                                       const char *name)
 {
+       const char *p;
        int ret;
 
+       /* safer to just disallow all control characters */
+       for (p = name; *p != '\0'; p++) {
+               if (*p < ' ')
+                       return FALSE;
+       }
+
        T_BEGIN {
                string_t *str = t_str_new(256);
                ret = imap_utf7_to_utf8(name, str);