Mercurial > dovecot > original-hg > dovecot-1.2
diff src/plugins/trash/trash-plugin.c @ 4602:444edc8abef9 HEAD
Don't allow giving NULL parameter to array_get() or array_get_modifiable().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 16 Sep 2006 16:40:17 +0300 |
parents | bf4e98a0de3f |
children | 5fb199ed254a |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Sat Sep 16 16:31:14 2006 +0300 +++ b/src/plugins/trash/trash-plugin.c Sat Sep 16 16:40:17 2006 +0300 @@ -186,6 +186,7 @@ struct istream *input; const char *line, *name; struct trash_mailbox *trash; + unsigned int count; int fd; fd = open(path, O_RDONLY); @@ -211,9 +212,8 @@ i_stream_destroy(&input); (void)close(fd); - qsort(array_get_modifiable(&trash_boxes, NULL), - array_count(&trash_boxes), sizeof(struct trash_mailbox), - trash_mailbox_priority_cmp); + trash = array_get_modifiable(&trash_boxes, &count); + qsort(trash, count, sizeof(*trash), trash_mailbox_priority_cmp); return 0; }