Commit 12e921ad authored by Richard P. Curnow's avatar Richard P. Curnow

Ensure messages arrays are definitely always enlarged.

Vincent Lefevre sent in a test case in which the first indexing run only placed
a single message in the database.  On a 2nd indexing run, the funcion
maybe_grow_message_arrays() did not actually expand the arrays which caused
heap corruption.
parent 7b9d1eef
......@@ -857,7 +857,7 @@ static int lookup_msgpath(struct msgpath *sorted_paths, int n_msgs, char *key)/*
void maybe_grow_message_arrays(struct database *db)/*{{{*/
if (db->n_msgs == db->max_msgs) {
if (db->max_msgs == 0) {
if (db->max_msgs <= 128) {
db->max_msgs = 256;
} else {
db->max_msgs += (db->max_msgs >> 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment