Skip to content

Commit

Permalink
Merge pull request cyrusimap#4157 from cyrusimap/matchmime_ignore_zer…
Browse files Browse the repository at this point in the history
…o_search_maxsize

jmap_mail_query: ignore config_search_maxsize if zero
  • Loading branch information
rsto authored Jun 30, 2022
2 parents 68fa09f + 3ce2474 commit eb6dc0d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions imap/jmap_mail_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,15 +524,20 @@ static int _matchmime_tr_append_text(search_text_receiver_t *rx,
{
struct matchmime_receiver *tr = (struct matchmime_receiver *) rx;

if (buf_len(&tr->buf) >= config_search_maxsize) {
return IMAP_MESSAGE_TOO_LARGE;
}
if (config_search_maxsize) {
if (buf_len(&tr->buf) >= config_search_maxsize) {
return IMAP_MESSAGE_TOO_LARGE;
}

size_t n = config_search_maxsize - buf_len(&tr->buf);
if (n > buf_len(text)) {
n = buf_len(text);
size_t n = config_search_maxsize - buf_len(&tr->buf);
if (n > buf_len(text)) {
n = buf_len(text);
}
buf_appendmap(&tr->buf, buf_base(text), n);
}
else {
buf_append(&tr->buf, text);
}
buf_appendmap(&tr->buf, buf_base(text), n);

return 0;
}
Expand Down

0 comments on commit eb6dc0d

Please sign in to comment.