From a97543c35bcaa92876de749c6569a52ec9ed23dd Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Fri, 28 Sep 2018 14:22:09 -0700 Subject: [PATCH] Change imap_rename_mailbox to use a BUFFER. --- imap/imap.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/imap/imap.c b/imap/imap.c index 7104dbb1..ed70abf4 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -133,17 +133,22 @@ int imap_rename_mailbox (IMAP_DATA* idata, IMAP_MBOX* mx, const char* newname) { char oldmbox[LONG_STRING]; char newmbox[LONG_STRING]; - char buf[HUGE_STRING]; + BUFFER *b; + int rc = 0; imap_munge_mbox_name (idata, oldmbox, sizeof (oldmbox), mx->mbox); imap_munge_mbox_name (idata, newmbox, sizeof (newmbox), newname); - snprintf (buf, sizeof (buf), "RENAME %s %s", oldmbox, newmbox); + b = mutt_buffer_new (); + mutt_buffer_increase_size (b, LONG_STRING); + mutt_buffer_printf (b, "RENAME %s %s", oldmbox, newmbox); - if (imap_exec (idata, buf, 0) != 0) - return -1; + if (imap_exec (idata, b->data, 0) != 0) + rc = -1; - return 0; + mutt_buffer_free (&b); + + return rc; } int imap_delete_mailbox (CONTEXT* ctx, IMAP_MBOX mx) -- 2.40.0