Mercurial > dovecot > original-hg > dovecot-1.2
diff src/imap/cmd-sort.c @ 877:7935347f54f1 HEAD
Don't access ImapArg's union members directly - too easy to mess up. Fixes a
crash with feeding non-string parameters to SEARCH/SORT commands.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 02 Jan 2003 10:09:26 +0200 |
parents | 8afbafd5deac |
children | fd8888f6f037 |
line wrap: on
line diff
--- a/src/imap/cmd-sort.c Sun Dec 29 21:44:37 2002 +0200 +++ b/src/imap/cmd-sort.c Thu Jan 02 10:09:26 2003 +0200 @@ -34,7 +34,7 @@ (size_t)-1); while (args->type == IMAP_ARG_ATOM || args->type == IMAP_ARG_STRING) { - const char *arg = args->data.str; + const char *arg = IMAP_ARG_STR(args); for (i = 0; sort_names[i].type != MAIL_SORT_END; i++) { if (strcasecmp(arg, sort_names[i].name) == 0) @@ -91,7 +91,7 @@ return TRUE; } - sorting = get_sort_program(client, args->data.list->args); + sorting = get_sort_program(client, IMAP_ARG_LIST(args)->args); if (sorting == NULL) return TRUE; args++; @@ -101,7 +101,7 @@ client_send_command_error(client, "Invalid charset argument."); } - charset = args->data.str; + charset = IMAP_ARG_STR(args); args++; pool = pool_alloconly_create("MailSortArgs", 2048);