Mercurial > dovecot > original-hg > dovecot-1.2
comparison 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 |
comparison
equal
deleted
inserted
replaced
4601:664011f3b1fb | 4602:444edc8abef9 |
---|---|
184 static int read_configuration(const char *path) | 184 static int read_configuration(const char *path) |
185 { | 185 { |
186 struct istream *input; | 186 struct istream *input; |
187 const char *line, *name; | 187 const char *line, *name; |
188 struct trash_mailbox *trash; | 188 struct trash_mailbox *trash; |
189 unsigned int count; | |
189 int fd; | 190 int fd; |
190 | 191 |
191 fd = open(path, O_RDONLY); | 192 fd = open(path, O_RDONLY); |
192 if (fd == -1) { | 193 if (fd == -1) { |
193 i_error("open(%s) failed: %m", path); | 194 i_error("open(%s) failed: %m", path); |
209 trash->priority = atoi(t_strdup_until(line, name)); | 210 trash->priority = atoi(t_strdup_until(line, name)); |
210 } | 211 } |
211 i_stream_destroy(&input); | 212 i_stream_destroy(&input); |
212 (void)close(fd); | 213 (void)close(fd); |
213 | 214 |
214 qsort(array_get_modifiable(&trash_boxes, NULL), | 215 trash = array_get_modifiable(&trash_boxes, &count); |
215 array_count(&trash_boxes), sizeof(struct trash_mailbox), | 216 qsort(trash, count, sizeof(*trash), trash_mailbox_priority_cmp); |
216 trash_mailbox_priority_cmp); | |
217 return 0; | 217 return 0; |
218 } | 218 } |
219 | 219 |
220 void trash_plugin_init(void) | 220 void trash_plugin_init(void) |
221 { | 221 { |