]> granicus.if.org Git - neomutt/commitdiff
Do not cache some unsafe header fields.
authorBrendan Cully <brendan@kublai.com>
Fri, 6 Apr 2007 00:07:58 +0000 (17:07 -0700)
committerBrendan Cully <brendan@kublai.com>
Fri, 6 Apr 2007 00:07:58 +0000 (17:07 -0700)
hcache.c

index 2d50bde675c0134fc93e4c1f9c5f53eb847ba542..b2b77f377e39e539f417967620e8b69723b09ad5 100644 (file)
--- 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);