[PATCH 06/13] Fix sync of non-user mailboxes
Bron Gondwana
brong at fastmail.fm
Tue Jan 27 23:15:33 EST 2009
If a non-user mailbox is being considered for promotion to a USER
event in sync_client, it trys to xstrdup the folder name starting
at the user name - except that's a NULL string and it segfaults.
This patch tests the result of mboxname_isusermailbox in the
conditional instead, and then makes the copy only if it's non-NULL.
---
imap/sync_client.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/imap/sync_client.c b/imap/sync_client.c
index d62c833..8a70974 100644
--- a/imap/sync_client.c
+++ b/imap/sync_client.c
@@ -3197,12 +3197,12 @@ static int do_sync(const char *filename)
if (r) {
/* promote failed personal mailboxes to USER */
struct sync_folder *folder;
- char *userid, *p;
+ char *userid, *p, *useridp;
for (folder = folder_list->head; folder && folder->mark;
folder = folder->next);
- if (folder &&
- (userid = xstrdup(mboxname_isusermailbox(folder->name, 0)))) {
+ if (folder && (useridp = mboxname_isusermailbox(folder->name, 0))) {
+ userid = xstrdup(useridp);
if ((p = strchr(userid, '.'))) *p = '\0';
folder->mark = 1;
if (--folder_list->count == 0) r = 0;
--
1.5.6.3
More information about the Cyrus-devel
mailing list