Changeset 5451:b9ac445b035b

Show
Ignore:
Timestamp:
2008-07-10 13:02:47 (3 months ago)
Author:
Rocco Rutte <pdmef@…>
Branch:
HEAD
Message:

Prevent some pointers of 'struct body' being saved to hcache

This addresses the hcache safety issue but maybe doesn't fix it
completely, see #2942. This also prevents mutt from crashing when
using a hcache that was synced when syncing the mailbox (updating
changed and fully-parsed messages).

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5449 r5451  
     12008-07-10 21:46 +0200  Aron Griffis  <agriffis@n01se.net>  (6244eefaea64) 
     2 
     3        * headers.c: Remove completely wrong comment regarding in-reply-to and 
     4        references 
     5 
     6        ...plus fix one other comment and some whitespace. 
     7 
     82008-07-09 09:14 +0000  Rocco Rutte  <pdmef@gmx.net>  (2a9e9c487bad) 
     9 
     10        * ChangeLog, doc/mutt.man, main.c: Document redirection to trigger 
     11        batch send mode in mutt(1) and mutt -h. Closes #2070. 
     12 
    1132008-07-04 09:09 +0200  Ralf Wildenhues  <wildenhues@ins.uni-bonn.de>  (74b54f11c919) 
    214 
  • hcache.c

    r5377 r5451  
    363363dump_body(BODY * c, unsigned char *d, int *off, int convert) 
    364364{ 
     365  BODY nb; 
     366 
     367  memcpy (&nb, c, sizeof (BODY)); 
     368 
     369  /* some fields are not safe to cache */ 
     370  nb.content = NULL; 
     371  nb.charset = NULL; 
     372  nb.next = NULL; 
     373  nb.parts = NULL; 
     374  nb.hdr = NULL; 
     375  nb.aptr = NULL; 
     376 
    365377  lazy_realloc(&d, *off + sizeof (BODY)); 
    366   memcpy(d + *off, c, sizeof (BODY)); 
     378  memcpy(d + *off, &nb, sizeof (BODY)); 
    367379  *off += sizeof (BODY); 
    368380 
    369   d = dump_char(c->xtype, d, off, 0); 
    370   d = dump_char(c->subtype, d, off, 0); 
    371  
    372   d = dump_parameter(c->parameter, d, off, convert); 
    373  
    374   d = dump_char(c->description, d, off, convert); 
    375   d = dump_char(c->form_name, d, off, convert); 
    376   d = dump_char(c->filename, d, off, convert); 
    377   d = dump_char(c->d_filename, d, off, convert); 
     381  d = dump_char(nb.xtype, d, off, 0); 
     382  d = dump_char(nb.subtype, d, off, 0); 
     383 
     384  d = dump_parameter(nb.parameter, d, off, convert); 
     385 
     386  d = dump_char(nb.description, d, off, convert); 
     387  d = dump_char(nb.form_name, d, off, convert); 
     388  d = dump_char(nb.filename, d, off, convert); 
     389  d = dump_char(nb.d_filename, d, off, convert); 
    378390 
    379391  return d; 
     
    621633  *off += sizeof (HEADER); 
    622634 
    623   d = dump_envelope(header->env, d, off, convert); 
    624   d = dump_body(header->content, d, off, convert); 
    625   d = dump_char(header->maildir_flags, d, off, convert); 
     635  d = dump_envelope(nh.env, d, off, convert); 
     636  d = dump_body(nh.content, d, off, convert); 
     637  d = dump_char(nh.maildir_flags, d, off, convert); 
    626638 
    627639  return d;