From 0836995366d97c8d123d0c51e9b8a7b64a63cf1d Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 5 Apr 2007 17:07:58 -0700 Subject: [PATCH] Do not cache some unsafe header fields. --- hcache.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hcache.c b/hcache.c index 2d50bde67..b2b77f377 100644 --- a/hcache.c +++ b/hcache.c @@ -502,6 +502,7 @@ mutt_hcache_dump(header_cache_t *h, HEADER * header, int *off, unsigned long uid_validity) { unsigned char *d = NULL; + HEADER nh; *off = 0; d = lazy_malloc(sizeof (validate)); @@ -519,6 +520,30 @@ mutt_hcache_dump(header_cache_t *h, HEADER * header, int *off, d = dump_int(h->crc, d, off); lazy_realloc(&d, *off + sizeof (HEADER)); + memcpy(&nh, header, sizeof (HEADER)); + + /* some fields are not safe to cache */ + nh.tagged = 0; + nh.changed = 0; + nh.threaded = 0; + nh.recip_valid = 0; + nh.searched = 0; + nh.matched = 0; + nh.collapsed = 0; + nh.limited = 0; + nh.num_hidden = 0; + nh.recipient = 0; + nh.attach_valid = 0; + nh.path = NULL; + nh.tree = NULL; + nh.thread = NULL; +#ifdef MIXMASTER + nh.chain = NULL; +#endif +#if defined USE_POP || defined USE_IMAP + nh.data = NULL; +#endif + memcpy(d + *off, header, sizeof (HEADER)); *off += sizeof (HEADER); -- 2.40.0