]> granicus.if.org Git - neomutt/commitdiff
Increase buffer sizes for some IMAP commands.
authorKevin McCarthy <kevin@8t8.us>
Fri, 28 Sep 2018 00:29:16 +0000 (17:29 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 1 Oct 2018 22:19:43 +0000 (23:19 +0100)
Use to ensure assembled IMAP commands fit in the resultant buffer to
be imap_exec()'ed.

RFC2683 suggested a limit of 1000, but asked servers to accept up to
8000.  Furthermore, RFC7162 bumped the client limit suggestion up to
8192.  So I don't believe any issues will be caused by this.

Most of these are increases are just to remove theoretical truncation
warned about by the compiler; I don't believe we've had reports of
actual command truncation due to a mailbox 1024 characters long.

imap/imap.c
imap/message.c

index 4256dfd0eb204aef4a1bfa4496a4286ee12ae270..2e2a4c8c47f755f166f9629726130a40b1693dc9 100644 (file)
@@ -600,7 +600,7 @@ int imap_access(const char *path)
 {
   struct ImapMboxData *mdata = NULL;
   struct ImapMbox mx;
-  char buf[LONG_STRING];
+  char buf[LONG_STRING * 2];
   char mailbox[LONG_STRING];
   char mbox[LONG_STRING];
   int rc;
@@ -664,7 +664,7 @@ int imap_access(const char *path)
  */
 int imap_create_mailbox(struct ImapMboxData *mdata, char *mailbox)
 {
-  char buf[LONG_STRING], mbox[LONG_STRING];
+  char buf[LONG_STRING * 2], mbox[LONG_STRING];
 
   imap_munge_mbox_name(mdata, mbox, sizeof(mbox), mailbox);
   snprintf(buf, sizeof(buf), "CREATE %s", mbox);
@@ -690,7 +690,7 @@ int imap_rename_mailbox(struct ImapMboxData *mdata, struct ImapMbox *mx, const c
 {
   char oldmbox[LONG_STRING];
   char newmbox[LONG_STRING];
-  char buf[LONG_STRING];
+  char buf[HUGE_STRING];
 
   imap_munge_mbox_name(mdata, oldmbox, sizeof(oldmbox), mx->mbox);
   imap_munge_mbox_name(mdata, newmbox, sizeof(newmbox), newname);
@@ -1445,7 +1445,7 @@ int imap_mailbox_check(bool check_stats)
   struct ImapMboxData *mdata = NULL;
   struct ImapMboxData *lastdata = NULL;
   char name[LONG_STRING];
-  char command[LONG_STRING];
+  char command[LONG_STRING * 2];
   char munged[LONG_STRING];
   int buffies = 0;
 
@@ -1548,7 +1548,7 @@ int imap_status(const char *path, bool queue)
   static int queued = 0;
 
   struct ImapMboxData *mdata = NULL;
-  char buf[LONG_STRING];
+  char buf[LONG_STRING * 2];
   char mbox[LONG_STRING];
   struct ImapStatus *status = NULL;
 
@@ -1721,7 +1721,7 @@ int imap_search(struct Mailbox *mailbox, const struct Pattern *pat)
 int imap_subscribe(char *path, bool subscribe)
 {
   struct ImapMboxData *mdata = NULL;
-  char buf[LONG_STRING];
+  char buf[LONG_STRING * 2];
   char mbox[LONG_STRING];
   char errstr[STRING];
   struct Buffer err, token;
@@ -1793,7 +1793,7 @@ int imap_complete(char *buf, size_t buflen, char *path)
 {
   struct ImapMboxData *mdata = NULL;
   char list[LONG_STRING];
-  char tmp[LONG_STRING];
+  char tmp[LONG_STRING * 2];
   struct ImapList listresp;
   char completion[LONG_STRING];
   int clen;
index 9149e1d793f7d5a2ae6ebebb3a0595f0484a75cf..006283dbc152b703f7650a9ceae43ae0a405b632 100644 (file)
@@ -1340,7 +1340,7 @@ bail:
 int imap_append_message(struct Context *ctx, struct Message *msg)
 {
   FILE *fp = NULL;
-  char buf[LONG_STRING];
+  char buf[LONG_STRING * 2];
   char mbox[LONG_STRING];
   char mailbox[LONG_STRING];
   char internaldate[IMAP_DATELEN];