]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Maildir: If filename has CR or LF, log a warning and ignore it instead of
authorTimo Sirainen <tss@iki.fi>
Sat, 12 Jul 2008 13:16:19 +0000 (16:16 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 12 Jul 2008 13:16:19 +0000 (16:16 +0300)
writing a corrupted dovecot-uidlist.

--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-uidlist.c

index 53af5bfa7731834528dbfdf81634de77408c760f..44177f3c88fdb991e40c1f110264c8342ebedcef 100644 (file)
@@ -1370,10 +1370,19 @@ int maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
 {
        struct maildir_uidlist *uidlist = ctx->uidlist;
        struct maildir_uidlist_rec *rec, *old_rec;
+       const char *p;
 
        if (ctx->failed)
                return -1;
 
+       for (p = filename; *p != '\0'; p++) {
+               if (*p == 13 || *p == 10) {
+                       i_warning("Maildir %s: Ignoring a file with #0x%x: %s",
+                                 uidlist->mbox->path, *p, filename);
+                       return 1;
+               }
+       }
+
        if (ctx->partial) {
                maildir_uidlist_sync_next_partial(ctx, filename, flags);
                return 1;