Skip to content

Commit e04a3a5

Browse files
committed
net_imap: Increase buffer size for headers length to 32 KB.
Increase buffer used for all headers for FETCH response 4x from 8,192 to 32,768. This still isn't foolproof, but should work better, short of using a dynamically resized buffer for this operation. (At the very least, this buffer size is sufficient to handle all of my 300,000+ archived messages.)
1 parent ce09f17 commit e04a3a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nets/net_imap/imap_server_fetch.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ static void adjust_send_offset(struct fetch_body_request *fbr, off_t *restrict o
262262

263263
static int send_filtered_headers(struct imap_session *imap, struct fetch_body_request *fbr, const char *itemname, FILE **restrict fp, const char *fullname, const char *headerlist, int filter)
264264
{
265-
char headersbuf[8192];
265+
/* XXX FIXME This should probably be dynamically allocated/resized as needed.
266+
* No matter how large of a static buffer we use, it's always possible that the headers will be longer.
267+
* Downside of that would be efficiency, since that could be a lot of large allocations/deallocations
268+
* for a FETCH 1:* operation. */
269+
char headersbuf[32768];
266270
size_t headersbuflen = sizeof(headersbuf);
267271
char *buf = headersbuf;
268272
size_t len = headersbuflen;

0 commit comments

Comments
 (0)