]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_tools.c
set the type of the pointer into sizeof, so its definitely the right
[citadel.git] / citadel / modules / imap / imap_tools.c
index d1c5d9580df5006cd58e625d5299f9e847ba7100..bced70fd1f3e4fd50a035b368d594a284ca3eebe 100644 (file)
 #include "imap_tools.h"
 #include "ctdl_module.h"
 
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
-
 /* String handling helpers */
 
 /* This code uses some pretty nasty string manipulation. To make everything
@@ -569,13 +565,13 @@ void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf)
        if (qrbuf->QRflags & QR_MAILBOX)
        {
                if (strcasecmp(qrbuf->QRname+11, MAILROOM) == 0)
-                       p = toimap(p, bufend, "INBOX");
+                       toimap(p, bufend, "INBOX");
                else
                {
                        p = toimap(p, bufend, "INBOX");
                        if (p < bufend)
                                *p++ = '/';
-                       p = toimap(p, bufend, qrbuf->QRname+11);
+                       toimap(p, bufend, qrbuf->QRname+11);
                }
        }
        else
@@ -586,7 +582,7 @@ void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf)
                p = toimap(p, bufend, fl->f_name);
                if (p < bufend)
                        *p++ = '/';
-               p = toimap(p, bufend, qrbuf->QRname);
+               toimap(p, bufend, qrbuf->QRname);
        }
 }
 
@@ -840,7 +836,10 @@ star:
                                }
                                return WILDMAT_TRUE;
                        }
-                       while (!IsEmptyStr(text) && (*(text - 1) != WILDMAT_DELIM)) {
+                       while (!IsEmptyStr(text) &&
+                              /* make shure texst - 1 isn't before lcase_p */
+                              ((text == lcase_text) || (*(text - 1) != WILDMAT_DELIM)))
+                       {
                                if ((matched = do_imap_match(text++, p))
                                   != WILDMAT_FALSE) {
                                        return matched;